nit: we can close the output stream and the input stream separately, so this could be checkOutNotClosed