fix resource leak in builddep.py.

Note that contextlib.ContextDecorator is not available in py2.