pywikibot.data.api.APIError: readonly: The database has been automatically locked while the slave database servers catch up to the master [readonlyreason:Waiting for 5 lagged database(s); help:See https://en.wikipedia.org/w/api.php for API usage.]
makes the program crash, which means it has to be restarted manually. This should probably not happen. Make it wait a couple seconds, then try again.
Mentioned here: T154011.