Add checks to raise if db is not currently open and you try to do db operation