Add in registrar happens early in startup, and
will be run near the end of shutdown.
Even if iocInit() isn't run.
Also use an initHook to add cleanupPy(), which
happens late in startup, and will be run early
on shutdown. Though only if iocInit() is run.
Py_InitializeEx(0) tells the embedded interpreter to not install signal handlers. This fix is ignored by Python <3.7. See https://bugs.python.org/issue35233.