Fixed apparent resource leak using try with resources statement