Moved write cache before sending to master. 

This allows for the master to go down during a job and not have the job results lost if cache is enabled.