@Steven P
The code gave me some odd behaviour due to this:
Note: If the target file already exists, this function fails.
Managed to solve it with this function for now:
(defun is-file-locked (file-path)
(setq file (open file-path "w")) ; Try to open the file in write mode
(if file
(progn
(close file) ; If successful, close the file
nil) ; Not locked
t) ; If failed, it is locked
)