ncurses: fix exit

Closes #11877