Cannot catch error attempting Realm open with wrong encryption key

My app accesses a single Realm database from several threads (2 background threads + main). It was working fine, but now I am trying to encrypt it. If the user enters the wrong password they will get the wrong encryption key, and attempting to open the Realm file should fail. This is a normal part of the app. The problem is that once I have used the Realm file, attempting to open it with the wrong encryption key results in the app crashing with the message: “… already opened with different encryption key…”. The call that fails is prefaced with ‘try’ and is in a do{}catch{}, so the error should be caught. In fact the error is caught if I haven’t used the database yet. Once I have opened the database, however, the error switches to one that cannot be trapped.

Following some online advice, I tried putting my ‘Database’ object (the one containing references to the Realm file) inside an ‘autoreleasepool’:

autoreleasepool {
myDB = Database()
myDB = nil
myDB = Database()

And in this case I am able to catch the error: “Unable to open a realm at path…Invalid mnemonic…”

So I have 2 questions:

1.) Is it safe to assume that once I am catching an error opening the realm with the wrong encryption key that I will always be able to catch such errors and they won’t corrupt anything? So does it decrypt to garbage and then just try to use the result, and I happen to be getting invalid mnemonic in this particular case?

2.) Can you suggest a way to wrap my Realm accesses in autoreleasepools to solve the uncatchable exception problem? I am accessing the Database objects all over the place.