fix: emit end after the 'after_flush'

Emit end event after the after_flush event so that downstream pipes
can wait for tests to complete and not be hung doing so.