The affidavit shall be filed in the office of the clerk of the superior court having jurisdiction within five days after either the completion of the official canvass or the completion of any postcanvass risk-limiting audit conducted pursuant to Section 15560 by the county last making the declaration. In the case of an office for which candidates are certified for the ballot by the Secretary of State, or in the case of a statewide ballot measure, the superior court having jurisdiction shall be the Superior Court for the County of Sacramento.