Fix which tabs to add to the recently closed ones
Refactor the close tab functionality