write out pid file