Moved fflush(structure_file) out of loop.