fix memory leak issue when closing ffemulatorDlg.