add error check to kill command

this checks to see if kill was successful before deleting the pid file