Handles exit correctly now, thanks to code example from Sidekiq