Refactor closeIdleTabs