Fixed file lock issue