Implementing Lock for reading Files