Fixed potentially resource leaks when closing only an InputStream and
not the used Reader