Added shutdownhooks to classes that use threads.