Revise the termination of the connection
Revise the termination of the connection to be more straight forward:
- check triggers:
- close event
- error in current process (e.g. connection (setup tunnel, get cookie, ...))
- disconnect event
- ensure complete disconnect