remove the state when the tab is closed