prevent window leak by dismissing dialog on destroy