Let $X$ be a compact metrizable topological space and let $f$ be a bounded, real valued, Borel function on $X$. Denoting by $P(X)$ the collection of all probability measures on $X$, consider the subset $$ Z(f):= \left\{μ∈P(X): \int_X fdμ=0\right\}. $$
Question: What is the most general condition one should require of $f$ to ensure that $Z(f)$ is closed in the weak* topology of $P(X)$ (seen within the dual Banach space of $C(X)$).
For obvious reasons $Z(f)$ is closed when $f$ is continuous, but it is also closed if, say, $f$ is the pointwise limit of an increasing sequence $\{f_n\}_n$ of non-negative continuous functions (hence lower semi-continuous). This is because $$ Z(f) = \bigcap_nZ(f_n), $$ so $Z(f)$ is closed.
On the other hand, if the Borel subset $A⊆X$ is not open, there exists a sequence $\{x_n\}_n$ in the complement of $A$, converging to a point $p$ in $A$. In this case the Dirac measures $δ_{x_n}$ all lie in $Z(1_A)$ (by $1_A$ I mean the characteristic function of $A$), and they converge weak*ly to $δ_p$, which isn't in $Z(1_A)$. Therefore $Z(1_A)$ is not closed!