shutdown when tab closed Fixes #737

review? @ochameau