Fix to querywindow.pas

Moved line 1656 below RemovePreviousResultTabs to fix exceptions in
Win32