Add a lock on a file to prevent two processes to run at the same time.