Retry transactions when deadlocked

Fixes #63