toggles reading and writing