Fix the copy issue

The done callback should be moved inside the render method after the file has been written.