Fix deadlocks in readProcess{,WithExitCode}

The problem is in the exception handler in readProcess. When it receives
an asynchronous exception, it tries to clean up by closing the pipes.
However the attempt to close outh blocks because the reader thread
(reading with hGetContents) is blocking on the handle.

This fixes #8483.

Signed-off-by: Austin Seipp <austin@well-typed.com>