Fix error in REPL term shutdown leaving tty unsane

Previously we did not close the liner term unless a SIGINT or SIGKILL was received. This left the terminal in raw. Fix that.