The cause usually is an application that is not releasing memory to allow shut down to complete.
One way to find out which app, is to use a selective startup. In the startup tab of msconfig, you could uncheck like 1/2 of the startup items, allow windows to load, then shutdown. If issue persists, the cause is in the other startup items. Process of elimination.