open с with и без with

Есть два способа закрытия файла

with open('hello.txt', 'w') as outfile:
    print('HELLO', file=oufile)

Как только файл "выходит" из with, то он автоматически закрывается

reader = open('dog_breeds.txt')
try:
    # Further file processing goes here
finally:
    reader.close()