If the motor is not bad, you can try applying voltage to it to close the sunroof.
Remove the sunroof switch and dome light assy.
Remove the headlining and you can gain access to the motor.
Disconnect the motor and apply voltage to it. Reversing the polaity would open and close the sunroof. If motor is bad, remove motor and you can manually pull the sunroof close.