Prevent zombified shells after invocations.

- Close file descriptors given by popen after process death. Otherwise
the shell was left alive in the background.