Better testevent cleanup and event loop management