cleanup; checking on try-with-resources support
using try-with-resources construct