Fixes #110: Bad practice - Method may fail to close stream: updated to use try-with-resources