I'm not sure what else to do here?
Although process shutdown might be done differently, for instance terminating the process more violently, I don't think it's a very good solution and it also doesn't solve the problem with `TerminateThread` which might be called on a thread that is waiting on a condition variable.