My mates electric sunroof had the same problem we found that there are nylon sliders in the track and one had broken away so the class was jamming.
they are not replacement part so the sunroof was replaced and stripped down the old one and kept the bits in case it happened again.
SO open the roof and check if anything is broken, it may just be the handles drive box jamming up which is easy to replace just two bolts holding it on,