I have problem, when getting kick, and character list is opened, and ibot try to login on char it shows something about changed ip and need to write login and pass again, but reconnect, only try to login again, how to change it to make it close window with char list and login again?

Code:
--[[ Name: Auto Reconnect & Bp Opener by BlakW Version: v1.0 ]]-- 
--Account: 
accountNameIs = (Account) 
--Password: 
passwordNameIs = (Password) 
--Character name: 
characterNameIs = (CharName) 
--Main Backpack Name: 
mainBackpackName = MainBP 
--Loot Backpack Name: 
lootBackpackName = LootBP 
--Gold Backpack Name: 
goldBackpackName = GoldBP 
--Mana Backpack Name: 
manaBackpackName = PotBP 
if (connected == false) then connect(accountNameIs, passwordNameIs, characterNameIs) 
wait(600, 1800) 
pausewalking(10000) 
wait(1000) 
setcavebot("no") 
wait(1000) 
settargeting("no") 
wait(300) 
setlooting("no") 
wait(1000) 
openitem(mainBackpackName, "back") 
wait(2000) 
resizewindows() 
wait(200) 
openitem(manaBackpackName, mainBackpackName, true) 
wait(1000) 
resizewindows() 
wait(1000) 
openitem(lootBackpackName, mainBackpackName, true) 
wait(2000) 
resizewindows() 
openitem(goldBackpackName, mainBackpackName, true) 
wait(2000) 
resizewindows() 
wait(1000) 
setcavebot("yes") 
wait(1000) 
settargeting("yes") 
wait(1000) 
setlooting("yes") 
wait(1000) 
end