Exit read-only mode before exiting the minor mode