fixed the tab closing bug!