Make the threads stop on exit