Fix bug clearing pexpect buffer