title: Swift Firebase Delete An user when app will terminate
body: <p>Im trying to Delete user when app will terminate but this does not work.
  If I have an anonymous user signed in and the user close the app I don't want firebase to save the anonymous user. I want to delete it. This is my current code. Thank you in advance</p>
  
  <pre><code>func applicationWillTerminate(_ application: UIApplication) {
          // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
          if let users = Auth.auth().currentUser {
              if !users.isAnonymous {
                return
              }else {
                  users.delete(completion: { (error) in
                      if error != nil {
                          print(error!)
                          return
                      }
                      try! Auth.auth().signOut()
                      print("Anonymous user deleted")
                  })
              }
          }
      }
  </code></pre>