Reverted the render events to their original and adapted the test to avoid async race

I reverted the events, since their is some value in getting the render event before the file is written and beside I did not know about the `write` event. I changed the test accordingly to prevent async races.