If you are having trouble getting the services to stop you should give Powershell a try. I don't use it in the script above but, you can use the "-force" flag to forcefully terminate a process that is hanging. I recomend at the very least trying to stop the process without using the -force flag first to avoid any data loss from terminating a process before it has committed user changes.
Here are some exaples for ending a process and service:
Try to end them in a "nice" way:
Get-Process "PTC-Windchill" | Stop-Process
Get-Service "PTC-Windchill" | Stop-Service
Force them to stop:
Get-Process "PTC-Windchill" | Stop-Process -force
Get-Service "PTC-Windchill" | Stop-Service -force