Why `at_exit` and not an `ensure` block or opening the file in a block?  Is it an optimization?  

If someone runs this via rake task or, in the future, programmatically, wouldn't `at_exit` possibly have unexpected results?