Closing InputStream, if it was opened before