Refactor to use close and not stop in threading classes