Terminate gracefully on interrupt