And until he found out that Kim had already confessed about Howard, he seemed prepared to throw her under the bus. Not to save himself, he had already done that by negotiating it down to 7 years, but for ice cream. Still angry and frustrated by that last call with Kim and thinking she got away with everything, he was about to gratuitously stick it to her. Once he found out that she had come clean, thanks in no small part to his goading of her on that call, he knew what he had to do. Too late to repair things with Chuck even if he wanted to, too late to apologize to Howard, but not too late to gain back some respect from Kim. But I believe he would not have done so if she had not shown up to the courtroom to hear him in person.