Fix opening file on Python 2