File lock finifshed, added tests.
file lock improved, new tests added