You will need to note which applications failed to quit at shutdown. There is an obvious problem when this happens, and the problem is associated with the indicated application(s). There may be a problem with a corrupted preference or cache file that is causing the application(s) to hang.
You can start by deleting the preference file(s) of the suspect application(s). You will find them in the /Home/Library/Preferences/ folder. Usually they are in the form of "com.author.applicationname.plist." Then download and install AppleJack -
VersionTracker or
MacUpdate. Read the documentation carefully then use the program as instructed. See if that helps.