Here is my comment in more details
For any system or single elementary particle mass $M$ is defined as $$ M = \sqrt{E^2 - \textbf{P}^2} $$ where $E$ is total energy and $\textbf{P}$ is total momentum.
For an elementary particle (like electron) mass is always conserved.
For a system $M$ is conserved as long as $EdE - \textbf{P}d\textbf{P} = 0$, in particular mass of a closed system is conserved.
However for a composite system mass of the system is not generally equal to sum of masses of individual constituents (mass is not an "additive" quantity): $M \neq m_1 + m_2+...$.
E.g. consider a system of two non-interacting particles: $$ M^2 = (E_1 + E_2)^2 - (\textbf{P}_1 + \textbf{P}_2)^2 = E_1^2 -\textbf{P}_1^2 + E_2^2 - \textbf{P}_2^2 + 2(E_1 E_2 - \textbf{P}_1\textbf{P}_2) = m_1^2 + m_2^2 + 2(E_1 E_2 - \textbf{P}_1\textbf{P}_2) $$ If $m_1 \neq 0$ you can choose rest-frame of particle 1, where particle 2 moves with some relative speed then $E_1 E_2 - \textbf{P}_1\textbf{P}_2 = m_1 E_2$, and so $$ M^2 = m_1^2 + m_2^2 + 2m_1E_2 = (m_1+m_2)^2 + 2m_1(E_2-m_2) $$ So you see that in this case $M > m_1 + m_2$ because of energy of relative motion $E_2-m_2 > 0$. You can "extract" energy $M - (m_1+m_2)$ from this system.
The most striking example is probably a system of two photons of the same energy $\omega$ moving at angle $\theta$. In this case $$ M = 2\omega \sin\frac{\theta}{2} $$
In case of a bound system of two particles $M < m_1+m_2$ and you need to input at least energy $m_1+m_2-M$ (bound energy) to "break" the system apart.
This can be easily generalised for arbitrary number of particles.
Now if particles were to interact their relative motion and/or composition can change. 512
So $\textbf{P}_1\textbf{P}_2 \neq \textbf{P}_1'\textbf{P}_2'$ and/or $m_1 \neq m_1'$ (e.g. $H$-atom emitted a photon and moved to a lower energy state thus decreasing its mass).
This is why if you simply add up masses before and after the interaction you will have $m_1 + m_2 + ... \neq m_1' + m_2' + ...$. However if the system as a whole remains closed during the interaction $M=M'$.
P.S. I don't consider "relativistic mass" because I find this concept useless and misleading. 28