Do not rely on anydbm providing iteritems()
Clean up handling of eventdb locks