Merge "Stops the loop when all files are closed."