title: Random Realm 'already opened with a different schema mode' errors
body: <p>In a Swift app I am setting the default Realm config in didFinishLaunchingWithOptions like this:</p>
  
  <pre><code>Realm.Configuration.defaultConfiguration = {
      var config = Realm.Configuration.defaultConfiguration
      config.deleteRealmIfMigrationNeeded = true
      return config
  }()
  </code></pre>
  
  <p>and then I am creating new Realm instances where needed, in 3 different ways - when reading:</p>
  
  <pre><code>let realm = try! Realm()
  let users = realm.objects(User.self)
  </code></pre>
  
  <p>and when writing:</p>
  
  <pre><code>let realm = try! Realm()
  if let user = realm.object(ofType: User.self, forPrimaryKey: userId) {
      try! realm.write {
          user.name = name
      }
  }
  </code></pre>
  
  <p>and in models:</p>
  
  <pre><code>import Foundation
  import RealmSwift
  import ObjectMapper
  
  final class User: Object, StaticMappable {
  
      @objc dynamic var id = 0
      @objc dynamic var name = ""
  
      override static func primaryKey() -&gt; String? {
          return "id"
      }
  
      func mapping(map: Map) {
          id &lt;- map["id"]
          name &lt;- map["name"]
      }
  
      static func objectForMapping(map: Map) -&gt; BaseMappable? {
          let objectOptional = try? Realm().object(ofType: self, forMapping: map)
          if let object = objectOptional {
              return object
          }
          return nil
      }
  }
  </code></pre>
  
  <p>The problem is that sometimes I am getting this error when creating new Realm instances in completion closures, which are heavily used:</p>
  
  <blockquote>
    <p>Fatal error: 'try!' expression unexpectedly raised an error: Error
    Domain=io.realm Code=1 "Realm at path
    '/var/mobile/Containers/Data/Application/...../Documents/default.realm'
    already opened with a different schema mode."
    UserInfo={NSLocalizedDescription=Realm at path
    '/var/mobile/Containers/Data/Application/...../Documents/default.realm'
    already opened with a different schema mode., Error Code=1</p>
  </blockquote>
  
  <p>How can I debug and resolve this?</p>