Who pays for closed primaries

And that’s pretty much it.

In states with closed primaries, who pays to run the election?

What do you mean by “closed”?

Did you have any specific states in mind?

Closed primary: only registered members of a given party may vote for its candidates. There is a separate ballot for each party having candidates in that election.

Open primary: any voter may vote for any candidate. A single ballot is given to all voters.

In California, and AFAIK in all states, the state and its counties pay for elections, period. Candidates pay small filing fees, which do little to offset election costs.