Make CliDialogHelper react to EOF properly, provide tests