Eliminate race condition in term_nonmain test.

The test was assuming an async operation will complete synchronously, which is bogus.

Resolves #368.