Revert "Use PostgreSQL, removing the lock file". Clean last commit. It was a failed attempt.

This reverts commit 7ac437b0195b6a03edf6e4c818603db70bb27c7f.