Raise error if write pointer shall be changed in read-only mode

... and vice versa.