Fix race condition when using a fork inside _test_pty_eof().