Just repeating what Dave48 said, because it is very important. Do not have the transmission in gear when loosening/tightening the nut. That could damage your transm. Instead (as Dave48 said) fix the front sprocket with the rear brakes and the chain. This is also the method when changing drive sprockets/chain, it is best to loosen the nut before cutting the chain, removing rear wheel, swingbar.