Silence unclosed resource warnings in Python 3