This usually occurs if Windows is having trouble closing a program. To avoid this problem, you should close all programs before you close Windows. If you had already done that, you will have to clean boot your system. Check out how to do this on answers.microsoft.com/en-us/windows/forum/windows_vista-performance/windows-stuck-at-logging-off-screen-after-trying/d99659e2-03d4-4b18-b3f1-cba3a438f07e.
Your computer got affected by viruses.If you have not any antivirus you can try Microsoft's malware removal tool-its free.Otherwise simply call anyone who has anti-virus install on his laptop. they can scan your computer with the help of a LAN cable.
Clear all the cookies from your browser while shutting down your computer + Delete temp files from your computer before shut down ( use run and type prefetch, select all and delete the files then close the window), Now again go to run type temp, select all files and delete them, now again close the window and go to run and type %temp%, select all the files and delete them. Once removed, delete them from recycle bin too. Refresh your computer and try to shut it down now. It happens when the computer is slow. If it works fine then ok, if it doesnt, then let me know, i will let you know other ways.