Modal Dialogs close automatically as soon as they lose focus
Do you consider that when a modal window loses focus it should close?
Note: This behavior is due to to the popup method, using the show method would solve this problem. When a method lose focus it will not close anymore. However, you would have to reconsider how the drawing is done so that the dialog window is actually closable (since as of now the closing button is not accessible).