[WIP] "abstract_ui" fixes and improvements

FWIW I noticed these things while prototyping a UI in python
This needs to be called if the channel is abruplty closed (i.e. without a cal to ui_detach).