correctly handle try-with-resources