diff --git a/LDDsimulation/LDDsimulation.py b/LDDsimulation/LDDsimulation.py
index c16233ac73295022f532c3748cac9ab55984579d..68aa1a00ecd70ca23c25265b6fd8418dc052b469 100644
--- a/LDDsimulation/LDDsimulation.py
+++ b/LDDsimulation/LDDsimulation.py
@@ -672,9 +672,9 @@ class LDDsimulation(object):
         all timesteps and write it to the solution file.
         """
         t = copy.copy(self.starttime)
-        for timestep in range(0,self.number_of_timesteps+1):
-            for subdom_ind, subdomain in self.subdomain.items():
-                file = self.solution_file[subdom_ind]
+        for subdom_ind, subdomain in self.subdomain.items():
+            file = self.solution_file[subdom_ind]
+            for timestep in range(0,self.number_of_timesteps+1):
                 for phase in subdomain.has_phases:
                     pa_exact = subdomain.pressure_exact[phase]
                     pa_exact.t = t
@@ -682,8 +682,8 @@ class LDDsimulation(object):
                     tmp_exact_pressure.rename("exact_pressure_"+"{}".format(phase), "exactpressure_"+"{}".format(phase))
                     file.write(tmp_exact_pressure, t)
 
-                file.close()
-            t += self.timestep_size
+                t += self.timestep_size
+            file.close()
 
     def write_subsequent_errors_to_csv(self,#
                                 filename: str, #
@@ -1017,7 +1017,7 @@ class LDDsimulation(object):
                 subdomain.pressure_prev_iter[phase].assign(pa0_interpolated)
                 subdomain.pressure_prev_timestep[phase].assign(pa0_interpolated)
 
-            # populate interface dictionaries with pressure values. The calc_gli_method
+            # populate interface dictionaries with pressure values. The calc_gli_term
             # of each subdomain reads from the interface.pressure_values_prev
             # and from interface.pressure_values dictionary so both need to be populated.
             subdomain.write_pressure_to_interfaces()