Fixed an intermittent deadlock in MainTest:
FlushListener could receive more than the expected number of flushes
before the VirtualTerminalInteractor was given control. So by setting
the flush count to zero in waitForFlushes(), flushes could be lost. Now
it only reduces the number of flushes by the expected number.