cleanup threads after shutdown