Switching between series and parallel battery connection
MOSFETs only block current in one direction. That's why the symbol contains that parasitic body diode. You have a short which may be unfixable without significantly more circuitry to support back-to-back NMOSFETs sharing a source connection so current in both directions is blocked. Just using a step up converter and series cells or step down converter and series cells is simpler since a floating gate drive supply is required for each back-to-back NMOSFET pair.