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

Oh yes, I didn't see the duplicated code below. The `close` event code above can now be removed though since `remove` will always be called. This will remove the code duplication.