I understand that normally the proof is peer reviewed by others before submitting for publication, but what happens if it turns out there was some problem in the proof invalidating it? Is their career over?
For errors that can be corrected without invalidating the main conclusions of a paper, the journal can publish a correction. This is a separate published item that explains the error that has been made and how it should be corrected.
If the paper is not salvageable, the journal or authors should retract it. The journal will publish a separate retraction notice that basically says that the previously published paper is removed.
One should note that the existence of these mechanisms does not mean that they are always used when errors are detected. In many cases errors in published papers just persist. Probably this is due to the correction process being quite formal, and there are little benefits associated to going through it.
Concerning the issue with the authors' career, it mostly depends on whether the problem was an honest error, or misconduct by the authors such as falsifying something to achieve better looking results. In the case of an honest error, it would in most cases not be the end of a career, though it may leave a bad impression. In the case of misconduct, there are a number of examples where it indeed means the end of a career.