Split a large method onTabClose() to small methods