lockfile: allow file locking to be retried with a timeout