Fix for #380, fallback to last open tab when closing tabs