SyncSessionStopPolicy::Immediately is supposed to close the Realm instance on the sync client thread before the close() call on the last Realm instance returned. But it seems it is not doing correctly.
This results:
Realm.deleteRealm() cannot apply to synced Realm.
RealmCache.doCreateRealmOrGetFromCache() for downloadRemoteChanges() cannot clean the Realm file if the downloading failed.