close working demo

* add logic to ensure that only online devices are considered
* add some important logging messages
* add logic to ensure all operations are nested inside a connection context