Fixed a ResourceWarning that wasn't properly fixed by the previous commit.

Also removed unused import in runtests.py.