After expiration of the prescribed period for preserving voted ballots, election returns, other election records, or other records that are preserved under this code, the records may be destroyed or otherwise disposed of unless, at the expiration of the preservation period, an election contest or a criminal investigation or proceeding in connection with an election to which the records pertain is pending. In that case, the records shall be preserved until the contest, investigation, or proceeding is completed and the judgment, if any, becomes final.