trying to clean up thread exit