shutdown when tab closed Fixes #737

review? @ochameau

This is brittle...