Don't close process's stdin if error occurs when reading

Signed-off-by: Max Brunsfeld <mbrunsfeld@pivotallabs.com>