Wraps a local variable of type AutoCloseable in a try-with-resources statement.