Fix stdout premature EOF

Don't close the job's stdin - only close the read end of the pipe, as
this was causing the remote client to close the connection prematurely.

Don't automatically close stdin when either stdout or stderr is closed;
instead, close stdin when both stdout and stderr are closed.

Fixes #3631

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
Yeah, let's ask someone. ping @jfrazelle @erikh