This happened with my Macbook...I went to Terminal in the Utilities folder and typed in: sudo periodic daily weekly monthy
then press return, it'll ask you for your password, type that in and wait a couple minutes until it prompts you again, then its done. This worked for me, its usually took 30-60 seconds to shut down and only the desktop showed with no icons or toolbar or dock on the desktop, but that fixed the problem, now it only takes 5 seconds 10 seconds tops to shut down
hopes this works for you