Fixes the issue where the last output file can be cut off mid-way through. Listens on the writeStream finish event instead of the template renderer end event.