Make extension process shutdown more reliable

In some cases, OS.Process.exit(1) was used to exit the interpreter
without running the shutdown code, which kills the 'git cat-file'
processes that are used to read objects from repositories, leaving
such processes hanging around forever.

(They can still end up hanging around forever, but this makes it
less likely, and is an obvious improvement given how the code was
structured.)