you have to take out the interior light to get to the sunroof mechanism, there you will see a bar pull that off , next to this is a circle with an oblong shape in the middle insert the bar into this and turn.
I'd have thought if it won't close electricaly because it is off the rails, it would really need putting back on before you try doing anything manualy.
Mark. Council estate lad.
And proud of it!
Member of the Guild of Experienced Motorists.