Avoid killing threads with TerminateThread, this can cause deadlocks.