Handle erroneous modes with neither 'r' nor 'w'