Check the sunroof rail for any blockage from clips or screw or plastic which is blocking the sunroof. Something similar happen to my previous car (very old model) that side clip of rail fallen on the sunroof rail preventing it to close.
If not get it checked with upholstery guys and they can open the sunroof and see if motor is dead or not.