Use "open()" to be compatible with Python 3

I'm not sure how to actually get to this branch. (If I did, I would add a test case.)