Firsty try these steps as I have found some shutdown issues with my imac just of late.
Quit all running apps before attempting a shutdown.
If using an airport connection make sure mail.app is quit before disconnecting as this seems to stop it from being quit after the connection is disconnected.
Also check the permissions as a safe guard as there maybe something out of whack which could be playing havoc
Also check the HD for errors as these can also cause strange...