Destroy dialog to prevent memory leak