Avoid ResourceWarnings in Python 3.