Check the owner’s manual. Some vehicles have an opening in the headliner through which you can manually crank the sunroof closed in an emergency.
If that’s not the case, I suggest you consult a service manual for the vehicle, and see what it says about sunroof operation, or lack thereof.