Extension of identity map on projective curve I was reading the following proof from a lecture note:

Theorem: Let X and Y be two projective non-singular curves which are birationally equivalent. Then they are isomorphic.
Proof: $X$ and $Y$ are birationally equivalent $\implies$ $\exists$ open sets $U \subseteq X$ and $V \subseteq Y$ such that there is an isomorphism $\phi: U \to V$. Since $Y$ is projective and $X$ is non-singular, we can obtain a  morphism $\psi_1: X \to Y$ extending $\phi$. Similarly, there is morphism $\psi_2:Y \to X$ extending $\phi^{-1}$. Finally, X and Y are Hausdorff spaces and since $\psi_1\circ\psi_2:Y \to Y$ and $\psi_2\circ\psi_1: X \to X$ extend $\phi\circ\phi^{-1} = id_V$ and $\phi^{-1}\circ\phi = id_U$ respectively, we have $\psi_2\circ\psi_1 = id_Y$ and $\psi_1\circ\psi_2 = id_X$. Thus X and Y are isomorphic.

I'm completely fine with the Algebraic geometry part of the proof. What I'm struggling with is the Topology part. X is a Hausdorff space and $\psi_2\circ\psi_1: X \to X$ is an extension of $\phi^{-1}\circ\phi = id_U$ for open set $U \subseteq X$. Why does this imply $\psi_1\circ\psi_2 = id_X$? Can someone explain?
My definition of Projective variety and curve: A subset $Y$ of $\mathbb{P}^n$ is an algebraic set if it is zero set of a homogeneous polynomial in $k[x_0,x_1,...,x_n]$. A projective variety is an
irreducible algebraic set in $\mathbb{P}^n$ under Zariski topology. A projective curve is a projective variety of dimension 1.
Edit1: Is it true that open subset of a projective variety is always dense? Then I can see why the proof follows. But is this fact even true?
Edit2: I want to prove the above theorem using the following lemma:

Let $X$ be a curve, $Y$ a projective variety and $P \in X$ a non-singular point. Any rational map $\phi: X \to Y$ is defined at $P$.

As you can see, the above proof used this lemma when it said "we can obtain a  morphism $\psi_1: X \to Y$ extending $\phi$". So even if the above proof doesn't make sense, can you give another easy proof of this theorem that uses the above lemma (with the definition of projective curve I've mentioned)?
 A: For the question you ask in edit 1, any open subset of an irreducible topological space is dense. As your definition of variety includes irreducibility, the answer is yes.
For the method of solution of the problem using the fact you wrote in your second edit, the key statement is that the locus of agreement of two morphisms of varieties is closed(*). The strategy of the outlined proof is fine - if we let $U\subset X$ and $W\subset Y$ be the open sets where our rational morphisms $f_1:X\dashrightarrow Y$ and $f_2:Y\dashrightarrow X$ are defined, then $f_1\circ f_2: Y\to Y$ and $f_2\circ f_1:X\to X$ are rational maps which are equal to the identity on some open subset of $Y$ and $X$ respectively. By the lemma, $f_1\circ f_2$ and $f_2\circ f_1$ can be extended to honest morphisms $Y\to Y$ and $X\to X$. But this means that $f_1\circ f_2$ and $id_Y$ coincide on a dense open subset, so they're equal; similar reasoning for $f_2\circ f_1$ and $id_X$ gives that $X\cong Y$.

(*) This statement needs further conditions to be true once we upgrade to schemes - see here once you're at that level. If the quoted proof had said "separated" instead of Hausdorff, that would be a nod to this fact.
