(a) Immediately upon the arrival of the hour when the polls are required by law to be closed on election day, the elections official conducting the election shall openly, in the elections official's main office, in the presence of any persons who are present to observe, according to the procedure set forth in Section 14403, proceed to render every unused ballot remaining in the control of the elections official unusable. The elections official shall forthwith make and file an affidavit, in writing, as to the number of ballots destroyed. If the procedure in subdivision (c) of Section 14403 is used, the tamperproof seal shall be signed by the elections official and at least one deputy or assistant elections official or registrar. The sealed container shall then be placed, with the sealed containers containing unused ballots from the precincts, in a security area by the elections official until disposition is made pursuant to Section 17301 or 17302. Alternatively, the elections official may, immediately upon the arrival of the hour when the polls are closed, recycle for any other lawful purpose any unused ballots remaining in the control of the elections official that clearly identify the election for which they were prepared. No later than 30 days following the last day to certify the official results of the election, the elections official shall make and file an affidavit, in writing, as to the number of ballots recycled. At the elections official's discretion, the unused ballots may be recycled up to six months following an election or at the conclusion of an election contest proceeding, whichever is later.