Change user (if desired) after opening PID file.

Doing this ensures that the pid can be written by the starting user (often root) which helps avoid file permission issues in common pid/lock file directories.