prevent db deadlock errors by using one writer at a time