db: fix issue with multiple db opens