Fixed an issue that would cause the last page not to be fully processed when the Async Event is called

If the processing takes some time to be completed, having all the completed events executing asynchronously would cause the last page not to be completely executed because the main thread would exit before doing so. Because of that, the last page on the scheduler has to be executed synchronously (using a wait command) to avoid this issue.