Pythonic indenting `with` statement blocks
Yes, ideally, you close the with block as soon as possible, that way the file gets closed quickly - which means you are not (potentially) blocking access to it, having less file handles in use, etc...

Python does have scoping, it just doesn't make new scopes very often - only for functions and classes (and some other smaller cases, like list comprehensions and cousins in 3.x and above).

Unlike in Java, Python doesn't take the approach that every block is a scope, therefore loops, as you say in your question, don't introduce a new one.