improvements on file lock per bz916625
Merge pull request #1021 from clebertsuconic/master-fix

improvements on file lock per bz916625