Resolves one of the issues with CoD Black Ops Coldwar.
The problem happens when a thread calls TerminateThread() on self. When it is called on another thread the TEB is leaked. alloc_tls_slot() loops through dead threads' TEBs but that doesn't cause obvious problems. However, when TerminateThread() is called on self, loader thread detach is not executed but the TEB is freed in exit_thread. So if some new thread is reusing the same teb it gets linked into TlsLinks list for a second time and then traversing the list in consequent alloc_tls_slot() results in infinite loop.