Added missing CloseThread().