Retry writes when database is locked.