Online research lead me to this article in the mazda3forums and the following solution: manually closing the sunroof and ii only took 40 minutes.
you can read the forum for more details, but basically the steps I followed are:
1. remove the front part of the roof liner to access the motor moves the glass: involves removing the visors, over-the-door handles, map/console lights, and loosen up the windshield pilar covers.
Once the sunroof motor is in view; there is a screw that hold the motor in place. When this screw gets loose, the motor falls off sync with the gears that move the glass. If so, then tighten up the screw and try the switches.
If the switch doesn't move close the sunroof, look next to the holding screw and look for a hex bolt that allows you to move the glass manually.
Once the glass is aligned, and the switches work as normal, put everything back.