fix: Flushing at tab switch moved to exit:...

Flushing is now done as last ST window is closed. All DB's are flushed
at this point.
+ DB resetting moved to view activation (tab switch)