check if db is open before adding index