Let $X$ be an irreducible closed analytic set in $\Bbb C^n$ (i.e., $X$ is closed in the topology of $\Bbb C^n$ and locally the zero locus of a finite number of holomorphic functions) of analytic dimension $d$ (meaning that there is at least one $x \in X$ where $X$ is locally a complex manifold of dimension $d$). Let $\pi\colon \Bbb C^n\to\Bbb C^d$ be the standard projection on the first $d$ coordinates. Suppose that $\pi|_X: X \to \Bbb C^d$ is a proper, surjective and finite-to-one map with a uniform bound on the size of the fibers.
Question: How can I show that there is a closed analytic set $Z \subset \Bbb C^d$ of dimension $\dim_\mathrm{an} Z < d$ such that $$\pi|_{X \setminus \pi^{-1}(Z)}\colon X \setminus \pi^{-1}(Z) \to \Bbb C^d \setminus Z$$ is an analytic covering map (in particular, I need it to have constant fibers)?
I tried to work with $Z := \pi(\text{Sing}(X)) \cup \{y \in \Bbb C^d \mid y \text{ is a singular value for } \pi\}$ but I didn't manage to show that $\pi|_{X \setminus \pi^{-1}(Z)}$ has constant fibers and that $Z$ is a closed analytic set (Remmert's Proper Mapping Theorem doesn't apply since in general $X$ is not a smooth manifold).
I am pretty sure that $Z$ should be defined as the locus where the fiber size of $\pi$ is not maximal, but again I'm struggling to prove it has the right properties.
Additional info: $X$ is also definable in an o-minimal structure on $\Bbb R$ and therefore $\pi|_X$ is definable as well: this means in particular that since $\pi|_X$ is a finite-to-one map, there is an $N \in \Bbb N$ such that for all $y \in \Bbb C^d, |\pi^{-1}(y)| \leq N$, but existence of $Z$ should be a complex analysis issue, not a model theoretic one.