Closed-form solutions to $x''+\frac{k}{m}\ x+\mu\ g\ \text{sgn}(x')=0$ Close-form solutions to $x''+\frac{k}{m}\ x+\mu\ g\ \text{sgn}(x')=0$

Introduction______________________
I am looking for simple mechanics models that could have closed-form solutions that achieves finite extinction times where it becomes zero for their own system dynamics and stays there forever after.
Looking for simple systems I found in Wikipedia that a mass sliding in a horizontal plane under Coulomb friction is modeled by the differential equation of the Newton's 2nd law as:
$$  m\ x'' = -F - \mu\ m\ g\ \text{sgn}(x')$$
where the mass $m$, the earth's gravity acceleration $g$, and the kinetic coefficient of friction $\mu$ are positive constants.

I found here that the mass sliding after an initial push indeed slides until it stops moving, being their behavior described through a piecewise polynomial closed-form solution, representing the scenario where the force $F = 0$. As example is pretty obvious, which is good since can be easily found the procedure is right since results matches the classic answers found through energy analysis of the system.
Now, to move into the next step of difficulty, I want to model the exact example of the Wikipedia page, the case where the mass is attached to a spring, where the only additional force present besides the Coulomb damping. So modeling the spring as the classical force $F = k x$ with $k$ the string constant ($k>0$), the previous equation becomes:
$$  m\ x'' = -k\ x - \mu\ m\ g\ \text{sgn}(x')$$

The question
I have tried unsuccessful to solve the equation as I did for the case $F=0$, and so far I don't find any papers with closed-form solutions to the equation:
$$  x'' = -\frac{k}{m}\ x - \mu\ g\ \text{sgn}(x')$$
If I made every constant equal to one, then Wolfram-Alpha shows the following:

As expected for a non-linear equation there are multiple solutions. I am specially interested in the solutions were the mass stop moving (which is impossible to represent accurately through a linear ODE or non-piecewise power series, as explained here - otherwise it will violate the Identity Theorem), but differently from the mentioned example where I used a self-named endiness constraint: there exists a time $T>0$ such as $x(t) = 0,\ \forall t>T$, but for what I have found on the papers, in this mass-spring system also exists the possibility that the mass stops moving in a different position than the original rest position, so it could have a final position $x_f$ constant, such as $x(t) = x_f,\ \forall t>T$.
I hope you could find the closed-form solution that stops moving, showing the equations that determines the finite extinction time $T$ and the final position $x_f$, showing how you found them.
 A: Let's define the natural frequency $\omega = \sqrt{k/m}$ and the frictional length scale $L = \mu g/\omega^2$, then normalize to $\bar{x} = x/L$ and $\bar{t} = \omega t$. The differential equation takes the considerably simpler form
$$
\bar{x}'' + \bar{x} = -\operatorname{sgn}(\bar{x}').
$$
First, suppose the initial condition is $\bar{x}(0) = \bar{x}_1 >0$, $\bar{x}'(0) = 0$. Now if $\bar{x}_1 \le 1$, the spring can't overcome the force of friction and the solution will be $x(t) = x_1$. Otherwise, the object will move towards zero, so we have $\operatorname{sgn}(x') = -1$. That gives the inhomogeneous differential equation $\bar{x}'' + \bar{x} = 1$, which given the intial conditions solves to
$$
\bar{x}(t)= 1+\left(\bar{x}_1 - 1\right)\cos(\bar{t}),
$$
and in particular, the object will come to a stop at $\bar{x}_2 = 2-\bar{x}_1$ after time $\bar{t} = \pi$. Now, if $|\bar{x}_2| \le 1$, once again the object stops. Since we assumed that $\bar{x}_1 > 1$, this condition can only be satisfied if $\bar{x}_2$ is negative, so we will have $|\bar{x}_2| = \bar{x}_1 - 2$. Repeating this process until $|\bar{x}| < 1$, we have
$$
|\bar{x}_{n+1}| = |\bar{x}_{n}|-2\Longrightarrow |\bar{x}_{n+1}| = \bar{x}_1 - 2n,
$$
and $|\bar{x}| < 1$ will occur after $\lfloor \bar{x}_1/ 2\rceil$ iterations, where $\lfloor x\rceil$ is the nearest integer function. Thus, the time $T$ and location $X_f$ where an object at rest at initial position $x_1$ comes to a stop will be
$$
\omega T(x_1) = \pi\left\lfloor \frac{ x_1}{ 2L}\right\rceil\;\;,\;\;X_f(x_1) = (-1)^{\left\lfloor x_1/(2L)\right\rceil}\left(x_1 - 2L\left\lfloor \frac{x_1}{ 2L}\right\rceil\right)
$$
If the initial condition has nonzero velocity, we need to find where and how long it takes to turn around. Calling these initial conditions $x_0$ and $v_0$ and again assuming $x_0 > 0$, the solution is
$$
\operatorname{sgn}(v_0)\bar{x}(\bar{t}) = 1 - [\operatorname{sgn}(v_0)\bar{x}_0 - 1]\cos(\bar{t}) + |\bar{v}_0|\sin(\bar{t}),
$$
where $\bar{v}_0 = v_0/(L\omega)$. Finding the turning point of this thing involves some fun algebra, but I'll skip the details and jump to
$$
T_0(x_0,v_0) = \frac{1}{\omega}\tan^{-1}\left[\frac{\bar{v}_0}{\bar{x}_0\pm 1}\right]\;\;\;,\;\;\; x_1(x_0,v_0) = L\left[\sqrt{\bar{v}_0^2+(\bar{x}_0 \pm 1)^2} \mp 1\right]
$$
Putting this all together gives
\begin{eqnarray}
T(x_0,v_0) &=& \frac{1}{\omega}\tan^{-1}\left(\frac{\bar{v}_0}{\bar{x}_0\pm 1}\right)+\frac{\pi}{\omega}\left\lfloor \frac{\bar{x}_1}{2}\right\rceil\\
X_f(x_0,v_0) &=& (-1)^{\lfloor x_1/2\rceil}\left(\bar{x}_1 - 2\left\lfloor \frac{\bar{x}_1}{2}\right\rceil\right)L
\end{eqnarray}
where again, $\omega = \sqrt{k/m}$, $L = \mu g/\omega^2$, $\bar{x}_0 = x_0/L$, $\bar{v}_0 = v_0/(L\omega)$, $v_0 = \pm |v_0|$, and
$$
\bar{x}_1 = \sqrt{\bar{v}_0^2+(\bar{x}_0 \pm 1)^2} \mp 1.
$$
The numerical checks I did seem to agree with this. There's another way to do this using the total mechanical energy $\bar{x}'^2 + \bar{x}^2$ which gave me the same answer, but keeping track of all the signs in that gets annoying fast.
