Fix #2297 (crash after resize)

wrap some curses calls with try/except block