This API wraps flock(2) and also handles the file creation and deletion when the LockFile goes out of scope.