title: realm commit write error - Can't commit a non-existing write transaction
body: <p>I am trying to add a record to a realm DB table.</p>
  
  <p>I have a class Connection which represents a table I need in my DB and have created dynamic vars which are to represent the columns:</p>
  
  <pre><code>import Foundation
  import RealmSwift
  import Realm
  
  open class ConnectionState: Object {
  
      open dynamic var _id : String = NSUUID().uuidString
      open dynamic var a : String = ""
      open dynamic var b : String = ""
      open dynamic var c : Int = 0
  
      open override class func primaryKey() -&gt; String? {
          return "_id"
      }
  
      required public init() {
          super.init()
      }
  
      required public init(realm: RLMRealm, schema: RLMObjectSchema) {
          super.init(realm: realm, schema: schema)
      }
  
      required public init(value: Any, schema: RLMSchema) {
          fatalError("init(value:schema:) has not been implemented")
      }
  }
  </code></pre>
  
  <p>Then in my code I am trying to write and commit the write transaction like so:</p>
  
  <pre><code>let ConnectionState = ConnectionState()
  ConnectionState.a = "a"
  ConnectionState.b = "b"
  ConnectionState.c = 1
  try! self.realm.write {
       self.realm.add(ConnectionState)
  }
  
  try! self.realm.commitWrite()
  </code></pre>
  
  <p>When running this code, I am receiving the error: </p>
  
  <pre><code>Can't commit a non-existing write transaction
  </code></pre>
  
  <p>What am I missing? Do I need to have inits in my ConnectionState class?
  Before adding in the commitWrite, I was trying to view the db with realm browser. I found my device in xCode and chose to download the container but it was empty. Then I thought I needed to add in commitWrite </p>