Fix how pidfiles are written so that they prefer to write the child process' pid.