Java's is
try (var foo = new Foo()) {
}
// foo.close() is called here.
I like the Java method for things like files because if the there's an exception during the close of a file, the regular `IOException` block handles that error the same as it handles a read or write error.
What do you do if you wanna return the file (or an object containing the file) in the happy path but close it in the error path?