Write correct PID to file after daemonize