Implemented locks (on the File) for threads.