Fixed tab closing then running stuff