Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
My iMac (Mountain Lion 10.8.3) was not shutting down properly for around year. It would be stuck with the grey spinning gear and wouldn't move from here.

I tried the Safe Mode: http://support.apple.com/kb/HT1455 and now it shuts down properly.

This fixed my issue and hope it helps someone.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.