File locking

Added the file lock functions