code: private void closeIndex() {
          // TODO
          //NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(closeIndex) object: nil];
  
          // NOTE: view could be busy for indexing. as result, view.close() could fail.
          //       It requires to wait till view is not busy. CBL Java/Android waits maximum 10 seconds.
          for (int i = 0; i < 100 && _view != null; i++) {
              try {
                  _view.close();
                  _view = null;
              } catch (ForestException e) {
                  Log.w(TAG, "Failed to close Index: [%s] [%s]", _view, Thread.currentThread().getName());
                  try {
                      Thread.sleep(100); // 100 ms (maximum wait time: 10sec)
                  } catch (Exception ex) {
                  }
              }
          }
      }
docs: in CBL_ForestDBViewStorage.mm
  - (void) closeIndex