The answer to your question is no. The with block guarantees that the file will be closed when the control leaves the block for any reason, including exceptions (well, excluding someone pulling the power cord on your computer and some other rare events).
Therefore, it is recommended that you use the with block.
Now, perhaps by opening the file for reading only, and then unable to close it, this is not a problem. When garbage collection arrives (when possible), this file will also be closed if there is no longer a link to it; what happens when your program exits. In fact, a few code examples in white papers neglect to close a file that was open for read-only access. When writing a file or using the "read plus" mode, as in your example, you definitely need to close the file. There are many questions about how it works with incomplete / damaged files due to the inability to close them.
Tim Pietzcker Jan 22 '14 at 6:41 2014-01-22 06:41
source share