FreeDialogs example for Delphi

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); 
begin
   LEADDlgService1.FreeDialogs ( ); 
end;