Use finish event instead of end event when listening for marko template writer to finish