Power consumption of Nucleo L432KC board
SWD lines have internal pullups in the L432 which may put some current into the debugger. Try reconfiguring those pins to to analog with no pullup in your code.

If that does not work - physically cut off the ST-Link part, the board is designed to do that. Later on you can still program the L432 using jumper wires from the 6-pin header on the debugger part.

Also check the quiescent current of any regulators which are used to make 3.3V out of that 9V VIN.