Field-Induced Reversible Tuning of Oxygen Doping in High-Temperature Superconductors