cleanup function to restore terminal.