I'll write down how I fixed the final argument using KReiser's suggestion.
In case $X$ is affine, $X$ is an affine open cover of itself, so $Z=V(\mathfrak{p})=\overline{\{\mathfrak{p}\}}$ for some $\mathfrak{p}\in X$ (notice that here $V(\mathfrak{p})$ is merely a set, not a scheme). Such $\mathfrak{p}$ is unique because $V(\mathfrak{p})=V(\mathfrak{p}')\Leftrightarrow \mathfrak{p}=\mathfrak{p}'$, since $\mathfrak{p},\mathfrak{p}'$ are prime. So we have proven:
Lemma: every irreducible closed subset of an affine scheme has a unique generic point.
Now suppose $X$ is any scheme. For simplicity, assume $Z\cap U_i\neq\emptyset$ for every affine open $U_i$ in the cover.
We already know that $Z\cap U_i=\overline{\{\mathfrak{p}_i\}}\cap U_i$ for some $\mathfrak{p}_i\in U_i$.
Claim: $\mathfrak{p}_i\in U_i\cap U_j$ for all $i,j$.
Proof: Suppose $\mathfrak{p}_i\notin U_j$. Then $\mathfrak{p}_i$ is in $U_i\setminus U_j$, which is closed in $U_i$, therefore $\overline{\{\mathfrak{p}_i\}}\cap U_i\subset U_i\setminus U_j$. Consequently $Z\cap U_i\cap U_j=\overline{\{\mathfrak{p}_i\}}\cap U_i\cap U_j=\emptyset$. On the other hand, $Z$ is irreducible and $Z\cap U_i$ and $Z\cap U_j$ are nonempty open sets of $Z$, so their intersection $Z\cap U_i\cap U_j$ is nonempty (contradiction). $\blacksquare$
Now take an affine open set $V$ such that $\mathfrak{p}_i\in V\subset U_i\cap U_j$. Notice that:
$$\overline{\{\mathfrak{p}_i\}}\cap V=(Z\cap U_i\cap U_j)\cap V=\overline{\{\mathfrak{p}_j\}}\cap V$$
Since $V$ is affine, $\mathfrak{p}_i=\mathfrak{p}_j$ by the lemma. We might as well write $\mathfrak{p}=\mathfrak{p}_i$ for all $i$, so
$$Z=\bigcup_i\overline{\{\mathfrak{p}_i\}}=\overline{\{\mathfrak{p}\}}$$
Finally, if $\exists\,\mathfrak{p}'$ with $Z=\overline{\{\mathfrak{p}'\}}$, then $\overline{\{\mathfrak{p}'\}}\cap U_i=\overline{\{\mathfrak{p}_i\}}\cap U_i$ for any $i$. Since $U_i$ is affine, by the lemma, $\mathfrak{p}'=\mathfrak{p}_i=\mathfrak{p}\,\,_\blacksquare$
Best Answer
Hint: First the closure of a point is always irreducible, there's no need to pass through an affine neighborhood for that.
For the other direction if $C$ is an irreducible closed set and $U$ is open then show that $C \cap U$ is an irreducible closed subset of $U$.
Now $U \cap Z$ has a unique generic point when $U$ is affine. Show that if $V$ is also affine and $V \cap Z$ is nonempty then the generic point of $U \cap Z$ lies in $V$ and hence equals the unique generic point of $V \cap Z$.
Finally use the fact that affine opens form a base for the topology to show that the common generic point for all nonempty $U \cap Z$ is a generic point for $Z$, necessarily a unique one.