How do I wait until the report has finished rendering before the rest of the code gets executed?