use try-with-resources for models InputStream

we should not leave streams opened.