code: public void setAutoClose(boolean autoClose) {
          this.autoClose = autoClose;
  
          if (autoCloseHandlerRegistration != null) {
              autoCloseHandlerRegistration.removeHandler();
              autoCloseHandlerRegistration = null;
          }
  
          if (autoClose) {
              autoCloseHandlerRegistration = registerHandler(addValueChangeHandler(event -> close()));
          }
      }
docs: Enables or disables auto closing when selecting a date.