Algebraic Geometry: What am I doing wrong?
The set $Z(fy-1)$ is homeomorphic to $D(f)$, but not equal! While $Z(fy-1)$ is closed in $\mathbb{A}^{n+1}$, $D(f)$ is not, and this is no contradiction since they are not actually the same set.
You may find it helpful to think about the following more familiar example. An open interval $(0,1)$ is homeomorphic to $\mathbb{R}$. But $\mathbb{R}$ is closed in $\mathbb{R}$, while $(0,1)$ is not.
Let $C\subseteq Y\subseteq X$. If $C$ is closed in $X$, then $C$ is closed in $Y$.
If you are setting $Y = \mathbb A^n$, $X=\mathbb A^{n+1}$ and $C = D(f)$, then it is clear: $D(f)$ is not closed in $\mathbb A^{n+1}$ so the condition of your statement is not satisfied (But it is true that $D(f)$ is homeomorphic to a closed subset $Z(yf-1)$ of $\mathbb A^{n+1}$)