Actually its a very good question as we know
the neutron has no net charge this method cannot be used to determine its mass. Instead its mass must be deduced. It is known that deuterons its all are dissociate with gamma rays...
actually the correct formula to determine the mass is
mass of neutron = mass of deutron
− mass of proton
+ energy of gamma ray
mass of neutron = 1875.613789 − 938.272019 + 2.22457
= 939.565346 MeV