can we check this before opening and closing the db and fail fast