Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
When running tests in subprocesses with the regrtest -j option, a bug
in Cocoa Tk can result in a Tcl segfault.  Avoid the problem by forcing
Tk to fully initialize as an OS X gui process before destroying the
Tcl instance and creating another. (Original patch by Serhiy Storchaka)
Issue #22770: merge from 3.4