All of the errors in the integration were because I wasn't waiting for the variables to write to file before proceeding with the next step in the time loop.