ensuring index prior to db closex