Happened to me from time to time.
Usually happens after updating Windows, or installing new software.
Try running disk cleanup and delete all of the temporary files.
Also try uptading Windows, it might solve the problem.
If it doesn't help, and the problem just started, you could also try system restore to a previous backup.
That's what I did to get the PC shut down properly.