Quantum Error-Correction-Enhanced Magnetometer Overcoming the Limit Imposed by Relaxation