Fixed bug, when mainThread closed IPC queues before othre threads finished their job