Terminate gracefully on SIGINT, SIGTERM, SIGQUIT
Save pid to file