Fix resource warnings
diff --git a/pre_commit_hooks/check_docstring_first.py b/pre_commit_hooks/check_docstring_first.py
index 0896812..9988378 100644
--- a/pre_commit_hooks/check_docstring_first.py
+++ b/pre_commit_hooks/check_docstring_first.py
@@ -58,7 +58,8 @@
retv = 0
for filename in args.filenames:
- contents = io.open(filename, encoding='UTF-8').read()
+ with io.open(filename, encoding='UTF-8') as f:
+ contents = f.read()
retv |= check_docstring_first(contents, filename=filename)
return retv