Please use `with` context manager here.

Don't forgot to add `from __future__ import with_statement` to the to.