Replaced open/close calls with `with` statements
Merge pull request #2 from Lucretiel/patch-1

Replaced open/close calls with `with` statements