It seems to be strange but in fact it is not. It is because you do the creating new tab basing on the 'activate' event of a tab (Tab2 in your case) and this event happens not only by clicking on tab. It can happen when you close a tab because tabpanel will find and activate one of the remaining tabs and this will cause the 'activate' event happen.
Hope you understand what I mean.
P/S: Try to put your code inside the CODE tag then you will get more opportunity of getting support from the community.