Terminating heroku thread on exit