If $Y$ is a quasi-affine variety, then dim$Y$ = dim$\overline{Y}$ 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.
 A: Suppose, by absurd, that the $\overline{Z_0}\subset\ldots\subset\overline{Z_n}$ not be maximal. So, there is a variety $W$ such that $\overline{Z_i}\subsetneq W\subsetneq\overline{Z_{i+1}}$. Since that every $Z_j$ is closed in $Y$ we have $Z_i\subset Y\cap W\subset Z_{i+1}$. Since that $n=\textrm{dim }Y$ we have $Z_{i+1}=Y\cap W$ or $Z_i=Y\cap W$. In the first case we have $Z_{i+1}\subset W$ $\Rightarrow$ $\overline{Z_{i+1}}=W$ by passing through closure, contradiction. Consider now the case $Z_i=Y\cap W$. Since that $Y$ is quasi-affine there is an open $U$ in tha affine space such that $Y=\overline{Y}\cap U$ $\Rightarrow$ $Z_i=W\cap U$ is a open of $W$ so dense in $W$ $\Rightarrow$ $\overline{Z_i}\cap W=W$ $\Rightarrow$ $\overline{Z_i}=W$, contradiction. Since that $A(\overline{Y})$ is universaly catenary (H. Matsumura, Commutative Algebra) $n=\textrm{ht }\mathfrak{m}=\textrm{dim }\overline{Y}$ $\Rightarrow$ $n=\textrm{dim }\overline{Y}$ since that $A(\overline{Y})/\mathfrak{m}=k$.
A: I think the problem lies in the definition of "maximal chain". It means, in my opinion, first "unrefinable", that is you can not insert irreducible sets in between elements of the chain, and secondly "unextendable", that is you can not prepend or append further irreducible sets. 
Now the fact that for an integral affine $k$-Algebra $A$ all maximal chains have the same length (that is there are no chains which are maximal but have length $n' < \dim A$) is essentially true because of Proposition 1.8Ab which Hartshorne invokes in the proof. If you use this fact, you are obliged to give a proof of it as a separate lemma.
