Firebase Auth - createUser closure doesn't run

With this code, the user gets created, but the code in the closure never runs. I’ve retyped the code a few times to ensure no syntax errors, etc. But it doesn’t work. I am also using the signIn method and the closure works fine for it.

Any ideas are appreciated.

Auth.auth().createUser(withEmail: dbEmail, password: dbPassword) { (result, dberror) in
            print("Made IT Here")
            if dberror != nil {
                self.error = dberror!.localizedDescription
            else {
                UID = result!.user.uid
       = ""
                self.password = ""

After a few more hours of searching I determined this was due to Firebase calls being Asynchronous. I resolved this by moving the code that was waiting for the closure to finish inside the closure.