allow running another main loop after cancelling a previous one; fixes #2766