Is it possible to programmatically switch off those LEDs for battery powered projects you want to last as long as possible?
Nope. Your sketch does not impact the USB/Serial chip which controls those 2 LEDs.
Battery powered, use 3.3V/8 MHz Promini. Lower frequency and few components mean less power used.
Run at 1 MHz, save even more.
The power led, of course, has to be removed to disable it - it's hardwired in.
You can "remove" them if you really want too, but i dont seen the point in that