Python's way is a good compromise IMHO:
with open("/tmp/test.txt", "w+") as test_file:
do_something_with(test_file)
And you get test_file closed for free at the end of the block.