Use open() instead of file()

Python 3 no longer has file() as a type, so replace its usage with
a call to the builtin open() instead.