Would the flock() function prevent file corruption in this case whilst writing the file (in case two processes happen to try and write data to the file at the same time)?