Close all threads when doing un-deploy