Magnetic order driven ultrafast phase transition in NdNiO3