code: public synchronized void onClose() {
          if (state == State.DISABLED || state == State.DISABLING)
              throw new IllegalStateException("Do not call onClose if not opened before");
          if (state == State.WAITING) {
              state = State.DISABLED;
          } else {
              state = State.DISABLING;
          }
      }
docs: Call this in {@link org.microg.nlp.api.LocationBackendService#onClose()}.