in reply to Perl on window7

(Note: currently the code is pretty much unreadable due to lack of formatting.)

Perhaps you should stay away from actually killing Internet Explorer, and ask it to terminate nicely. You could use Win32::GuiTest (a module with a terribly inappropriate name) for that, and send an Alt-F4 key combination to it.

Or perhaps you could try to use the same instance of Internet Explorer for everything, instead of starting a new one every single time, perhaps with Win32::IE::Mechanize (with the browser visible).