(PUP-911) puppet agent exits with 0 despite pidfile creation failing

When puppet agent is run but cannot create a pidfile due to permission
errors or another running puppet process, the process exits with an
exit code of 0, despite reporting the failure.

This patch moves pidfile creation before the fork so that the appropriate
exit code is returned. 

This doesn't fix the whole class of problems; other failures after forking will still result in a 0 exit code despite problems starting the daemon. Since it's such a trivial fix it seems worth fixing this way until that's handled in a more comprehensive way later. 

Please let me know if there's a better way to structure the test - it's my first puppet PR and I'm totally open to a different approach.