shutdown when tab closed Fixes #737