lib: Properly terminate event listener thread
This fixes a long existing error where the thread that blocks on stdin and emits events is not terminated properly.
This resulted in e.g. the old thread consuming the first event after the TUI was restarted.
This fixes a long existing error where the thread that blocks on stdin and emits events is not terminated properly.
This resulted in e.g. the old thread consuming the first event after the TUI was restarted.
Rebase