Zmienna lub nie, nie ma wiele do rzeczy tutaj.
Z dokumentacji:
https://docs.python.org/3/tutorial/inputoutput.html
If you don’t explicitly close a file, Python’s garbage collector will eventually destroy the object and close the open file for you, but the file may stay open for a while. Another risk is that different Python implementations will do this clean-up at different times.
Dlatego dla najbardziej przewidywalnych wyników, rekomenduje się używać `with`.