No output when you forget to close a file
Modern operating systems use buffering when writing to files. When you explicitly close or flush a file handle, you ensure that all the pending output actually gets written out to the open file. Conversely, when you fail to do that, you may experience data loss.
The conventional solution in Python is to use
with open(...) which handles the closing of the file handle implicitly even in exceptional circumstances.