Last winter, I tried to open the sunroof. It tried to open, but didn't make it. Eventually, it opened, but later, in my garage, I tried to close it, and it won't go all the way closed. It will close if I fiddle with the button and get it in exactly the right spot. It used to close itself automatically without fiddling. What might be the issue?
The sun roof mechanism is most likely getting, or has gotten, corroded or rusted. In this case, it would need to be replaced. The switch contacts are loosing contact and the switch should be replaced as well.
The recommended thing to do is have the entire sun roof assembly replaced. However, you can try lubricating the unit and cleaning out the tracks. If doesn’t fix it, replacing the motor may be needed along with the switch. A certified mechanic can help you by diagnosing the state of your sunroof and fixing it accordingly.