File locking in write mode