better PID file creation