perl FileHandle Closure during after unlock

Hi
we have one function which is used to append data the file in exclusive lock mode in aperl script.
This script is executed by multiple threads at the same time.
accessing the same file.this script runs throught the day.

sometimes the file2.txt size is getting reduced.
for eg from 10 M to 2 M.

 
fi(file1.txt);
f2(file2.txt);
sub f1
{
 my ($file) = @_;
my $data="haitetsing";
 open(FileHandler,">>$file") ;
--flock function is called
  print FileHandler $data;
  --unlock funciton is called
}
 
 

query:-
here we did not close the Filehandle ,is it making the script to remove the some contents of file.

Is that the only code that writes to the file?

What does your flock code look like?