There is a sunroof reset procedure which is needed in order to make the sunroof close correctly after the following situations (I've found) :
- Disconnecting the battery
- turning off the car while the sunroof is closing/opening/otherwise moving
The procedure is explained in the car manual but here it is in any case :
- push to button to close the sunroof forward and hold for 10 seconds until you see the sunroof moving about (up and down) and coming back to its initial position.
- release the button, and before three seconds go by, push and hold the button forward again as if to close the sunroof.
- the sunroof will enter a full open and then close cycle; hold the button until the closing cycle is complete. Once released the sunroof is now ok