When interface is up and running 'kldunload if_iwx' stops the device and executes RUN -> INIT state transition.
Since the device is already stopped iwx_run_stop fails to stop the device again and returns non-zero exit code from iv_newstate callback which triggers 'INIT state change failed' assertion.
I reused IWX_FLAG_SHUTDOWN flag to:
a) set it in iwx_detach
b) check it in iwx_newstate_sub - when it is set all custom state transition logic is skipped
Accidentally found while experimenting with iwlwifi / iwx drivers