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

@alazier 
@tgoyne can you please wrap this in an `XCTAssertNoThrow`? Otherwise this won't show as a failing test.