My thoughts...
Is there an obstruction that is being sensed, such that the sunroof opens again?
I know mine went mad and opened randomly... so I closed it and took the fuse out ,so it simply stays closed now.
It originally decided to open on a rainy day.
My conclusion was that the switch at the top front was failing is some way.
I think it's a know fault.