handling multithreading exit