Graceful exit and cleanup.