More intelligent closing tab