After a long hard look this is looking like a possible conflict with BitDefender.
From our exchange:
I got rid of the AVG Anti rootkit and that didn't make any difference so I got rid of BitDefender next and now the computer shuts down properly.
The only problem now is whether to put the previous version of BitDefender back or not. For your information the version of BitDefender that was causing the problem was BitDefender Antivirus 2008. They have several "2008" products and I was using just the Antivirus 2008.
When I installed it I just double clicked on the file that I downloaded. Perhaps I should have done it in safe mode?
It would be worth it IMO to see if installing it in safe-mode will resolve this.