Fixing issue with the tabs being clicked twice and closing