if ( `window -exists myWindow` )
deleteUI -window myWindow;
if(`windowPref -ex myWindow`)
windowPref -remove myWindow;
Try these these are what I used when I had a similar problem
Alan
Technical Director - Framestore
Currently working on: Your Highness
IMDB