During the flyby the total energy and angular momentum of the solar system are conserved. Further, independent of the heliocentric energy change of the craft itself, the spacecraft’s total geocentric orbital energy per unit mass should be the same before and after the flyby. The data indicates this is not always true.
Instead, for Earth flybys by the Galileo, NEAR, and Rosetta spacecraft, the geocentric orbital energy after the closest approach to Earth was noticeably greater than the orbital energy before closest approach. So far, no mechanism, either external or internal to the spacecraft, that could produce these observed net changes in orbital energy has been identified.