Refactor use of #wait_for_pid_loop. Ensure pid_file gets deleted when removed.

On a file system with multiple threads accessing the same file, the FileUtils#rm command may encounter access_violation errors. Retrying fixes this. You can see this error if you replace the FileUtils#rm call with a call to system('rm -f ...'). FileUtils#rm does not report the error, but behaves functionally the same as calling system('rm -f ...').
Merge pull request #15 from cablegram/refactor-wait-for-pid-loop

Refactor use of #wait_for_pid_loop. Ensure pid_file gets deleted when removed