added curses deinit, even when error appears