Fix at exit in fork

MiniTest `autotest` currently fails to work correctly when using `Process.fork` in a test. This patch demonstrates the issue and proposes a fix.