avoid mutating of try-with-resources auto generated finally block