ensure the pipe is closed when we are done with the subprocess