Use sqlite3_busy_timeout to handle busy/locked errors

This simplifies the code.