Dont close prefs. window when terminating app (osx)

Closing the prefs. window seems actually to initialize it.
Visualize mutually exclusive UI constraints (osx)
Log lock start and finish
Reorganize command line param parsing (osx)
Wait a bit and delete existing session on WebSocket error
Fix tests