Energy flow control in a modular DC-DC converter with energy recovery