Residual current protection with emergency stop function