You should be consistent in how you open files. L39 uses `r` mode explicitly, but here the mode is implicit.