Eliminate race condition in term_nonmain test.