code: def shutdown(self):
          
          logger.debug('Waiting for service manager thread to finish ...')
          startTime = time.time()
          self._terminate.set()
          self._serviceStarter.join()
          # Kill any services still running to avoid deadlock
          for services in list(self.toilState.servicesIssued.values()):
              self.killServices(services, error=True)
          logger.debug('... finished shutting down the service manager. Took %s seconds', time.time() - startTime)
docs: Cleanly terminate worker threads starting and killing services. Will block
          until all services are started and blocked.