Fix lock management to avoid concurrent access to the backend repository.

Fix https://github.com/lfazio/pyodb/issues/13

Signed-off-by: Laurent Fazio <laurent.fazio@la-fenouillette.fr>