Ensures pipes get closed promptly.

Fixes a problem where a convoluted pipeline stalled as pipe 1 was waiting
for a process to read it, which was itself waiting for pipe 2 to be closed,
which didn't happen because pipe 1 was not being read.