Showing an analytic map has closed irreducible image Let $X,Y$ be complex algebraic varieties with $X$ (algebraically hence also analytically irreducible), $\pi : Y \to X$ an algebraic map with each fiber a finite set, and $g:X \to Y$ an analytic map such that $\pi \circ g=id$.
Then $g(X)$ is a closed analytically irreducible subvariety of the same dimension as $Y$.
It seems quite elementary to be honest, but I cannot figure out why it is true. Does anyone have any idea?
EDIT: The irreducible part is easy, I am interested in why it is closed and has dimension same as $Y$.
EDIT II: OK, I think I figured out the closed too, not in this generality but at least for the purposes that I want it. The dimension somehow seems intuitively clear since each fiber of $\pi$ is a finite set, but I'd still like to see a proof (or at least a hint in the right direction).
EDIT III: Damien's answer does not seem to work here because the map $g$ is assumed $analytic$, not algebraic (in fact this lemma is part of trying to show that in that context, $g$ is in fact algebraic, but we don't know it a priori).
EDIT IV: I just realized I do not know, why is the image a variety? I am sorry for the many questions, I am now learning that stuff.
 A: 
Let $\pi : Y\to X$ be a morphism of complex algebraic varieties. Suppose $Y$ is separated. Then the image of any analytic section $g : X\to Y$ is a closed analytic subspace of $Y$. 

Proof. I will copy the proof for algebraic maps. Let $\Delta: Y\to Y\times Y$ be the diagonal morphism $y\mapsto (y,y)$. As $Y$ is separated as algebraic variety, $\Delta$ is a closed immersion by definition. So 
$$ h : Y\times X \to (Y\times Y)\times X, \quad (y, x)\mapsto (y,y, x)$$
is also a closed immersion. Restrict, in the target space, to 
$$Z:=\{ (y_1, y_2, x) \mid \pi(y_1)=\pi(y_2), g(x)=y_2\}.$$ 
We then get a closed immersion $h^{-1}(Z)\to Z$. 
We have $h^{-1}(Z)=\{(y,x)\mid y=g(x) \}$. The projection $(y_1, y_2, x)\mapsto y_1$ is an isomorphism from $Z$ to $Y$ (in $Z$, $x=\pi(y_2)=\pi(y_1)$ and $y_2=g(x)=g(\pi(y_1))$). On the other hand, the projection $(y,x) \mapsto x$ is an isomorphism from $h^{-1}(Z)$ to $X$ (because in $h^{-1}(Z)$, we have $y=g(x)$). In the following commutative diagram
$$\begin{matrix}
h^{-1}(Z) & \stackrel{h}{\longrightarrow} & Z\\ 
\downarrow&&\downarrow\\
X & \stackrel{g}{\rightarrow}& Y \\ 
\end{matrix}
$$
$h$ is a closed immersion, and the vertical arrows are isomorphisms (of complex analytic spaces), so $g$ is a closed immersion.

Remark: if $Y$ is not separated, the statement is not true. Consider the line with doubled points (= the affine line plus one point, but is not the projective line) and project to the line. 

A: By a theorem of Grothendieck, because $\pi$ is quasi-finite, there exists $\rm Z$, an open immersion $i : \rm X \to Z$ and a finite morphism $\tilde \pi : \rm Z \to Y$ such that $\pi = \tilde \pi \circ i$.
Then let $\tilde g = i \circ g$. We have $\tilde \pi \circ \tilde g = \rm{Id}_Y$. But $\rm{Id}_Y$ and $\tilde \pi$ are proper morphisms and $\tilde g$ is separated, so it is proper. In particular $\tilde g(\rm Y)$ is closed in $\rm Z$. But as it is contained in $i(\rm X)$, $g(\rm Y)$ is closed in $\rm X$.
