Fix an assertion failure in -[RLMRealm invalidate] when the Realm is not in read mode

@alazier