OutputToInputStream improvements - closing the piped input stream. propagating the writer exception on close only if it's done