Troubleshoot model panel persists after window is deleted

After you delete a window, you must also manually delete its associated modelPanel using the deleteUI command. The model panel is not deleted automatically when the window is deleted.

For example:

// Create a window called myWindow
window -wh 640 480 myWindow; 
paneLayout; 

// Save modelPanel as a string named panel
string $panel = `modelPanel`; 
showWindow myWindow; 

// Set a script job so that when myWindow is deleted, modelPanel is also deleted
scriptJob -uiDeleted "myWindow" ("{ deleteUI -panel " + $panel + "; }");