Tcl_Exit() often results in segfaults on exit, when more than 1 thread is busy at the time of a Tcl_Exit(). The problem is that Tcl_Finalize cleans up the state used by active threads. This problem has existed for a long time. The comments in Tcl_Finalize indicate the expectation of 1 thread "there really should only be one thread alive at this moment."
I propose this possible solution:
1. move the invoking in Tcl_Finalize of Tcl exit handlers into TclInvokeExitHandlers();
2. Tcl_Finalize can call TclInvokeExitHandlers()
3. Tcl_Exit calls TclInvokeExitHandlers() instead of Tcl_Finalize().
Tcl_Finalize will still work for those that wish to use it, and Tcl_Exit will work in the multiple active threads case.