Gracefully stop at exit