Output PID file safely