Made write_pid_file be decoupled from command line parsing.  Also made it not be broken!