Reversal of Photon-Scattering Errors in Atomic Qubits