Creates a lockfile with the PID of the process stored in it, so we can test that the lock is not held by a defunct process