There is a manual override in the form of a hex nut, under the headlining between the sunroof and the interior light.
You need to carefully ease the headlining out of its trim to get access to it.
Doesn't exactly mend the problem but at least you can shut the sunroof!
Jim Entwistle, August 2012