Thermal stability of gas phase magnesium nanoparticles