fix write_pid called after daemonize call

To control daemonized process, we must call write_pid
after the daemonize() call.

Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
Merge pull request #36 from iHiroakiKawai/write_pid_after_daemonize

fix write_pid called after daemonize call