Fix bad file mode string, Fix #7958

Can't have both read and write.