No tab with id:

I hope this time i will get my answer.

user is on tab0
user clicks on this page and another tab opens up - it is active tab1
user clicks on this page and another tab opens up - it is active tab2
close all tab
so this is now tab0
user clicks on this page and another tab opens up - it is active tab1
BUT scripts rather going to tab1 , fails with text in red color
“[error]
No tab with id: 638.”