Fix EmergeThread hang on exit