trap TERM signals to prevent tty problems