SmartSelect.close() the instance on the open or opened event handlers seems to doesn't work properly

(Anyone who’s facing this, checkout the issue at github)

Describe the bug

Using smartselect.close() method on opened handler crashes closeByBackdropClick feature.
Using smartselect.close() method on open handler makes the open event doesn’t trigger anymore.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://jsfiddle.net/isaacbatst/xr1gdojp/32/
  2. Click on the button to init the smartselects
  3. Open the first smartselect three times to see the error 1.
  4. Open the second smartselect three times to see the error 2.

Expected behavior

Expected the smartselect to open when the counter equals 0 and to do not open when the counter equals 1.

Actual Behavior

Using smartselect.close() method on opened handler does my logic to open the smart select only when the counter equals 0, but it crashes closeByBackdropClick feature.

Using smartselect.close() method on open handler stops triggering the open event.

Additional context

The counter starts at 0 and it’s toggled each time you open the smartselect.
Each smart select has its own counter.