add logic for master to write a pidfile

# notes

I tried to place the logic in `bud.c` right above the call to `uv_run` but the ended up confused as to why there are 2 calls to `uv_run`... either way i've tested this and it seems to work as expected.
Thinking of which, could we just have a `pidfile` variable and check if it is different from `-1`?