Added protection to the opening of borked testdat.db files