Issue #25764: Preserve subprocess fork exception when preexec_fn used

Also fix handling of failure to release the import lock.
3 files changed