yeah. i've had that issue.. seemed like the little thing that seems like a deflector at the front of the sunroof opening(when you have it open) was not going down all the way.
i assume the sunroof has a sensor in which if it senses it is blocked, it will open back up.
i looked at it and tried pushing the deflector down a few times and closed the sunroof like that. that reminds me... i dont think i greased it afterwards