This is "normal" behaviour once the dialog has been told to close there is no longer a need to keep $dname.

The same occurs with @windows.

Eamonn.