Reading through the proof of proposition 1.10 in Hartshorne's Algebraic Geometry I found some of it to be unnecessary. Is the following proof correct or can you point out my flawed logic?
Let $Z_0 \subset ... \subset Z_n$ be a sequence of distinct closed irreducible subsets of $Y$. Notice that $\overline{Z_0} \subset ... \subset \overline{Z_n}$ is a sequence of closed irreducible subsets of $\overline{Y}$. This is because we know that if $Z_i$ is an irreducible subset of $Y$, then $\overline{Z_i}$ is irreducible in $Y$ and thus it is also irreducible in $\overline{Y}$. Thus we have that dim$Y$ $\leq$ dim$\overline{Y}$. Now dim$\overline{Y}$ is finite as $Y$ is a non-empty open subset of an irreducible space, so that it is irreducible and dense, yielding $\overline{Y}$ is an affine variety. Thus we can choose a maximal chain of distinct closed irreducible subsets of $Y$, $Z_0 \subset ... \subset Z_n$, with dim$Y=n$. Now $\overline{Z_0} \subset ... \subset \overline{Z_n}$ is a maximal chain of closed irreducible subsets of $\overline{Y}$, this is through a contradiction argument that uses the fact that a non-empty open subset of an irreducible space is irreducible and dense. I omit it here as my proof goes into too much detail.
Now from here Hartshorne goes to prove the dimension is $n$ by converting these to prime ideals and finding a maximum chain of those. I understand his proof and it is correct, but is it not correct to say that $\overline{Y}$ is an affine variety whose dimension is given by the supremum of all integers $n$ such that there exists a chain $A_0 \subset ... \subset A_n$ of distinct irreducible closed subsets of $\overline{Y}$? We proved that $\overline{Z_0} \subset ... \subset \overline{Z_n}$ was maximal so that by definition dim$\overline{Y}$ = $n$ = dim$Y$.
I am having trouble seeing a flaw in my proof and do not understand why it is necessary to go to a chain of prime ideals in order to argue the dimension of $\overline{Y}$ is in fact $n$. Any insight would be most appreciated.