actually, doing it this way it's possible that this InputStream remains open.

You should just use the file itself here, e.g. mapper.readValue(inputFile, ...), or else you should put this in a try/finally.