Hello,
I just fixed the problem by making a slit with a fine electric rotary grinder where the screw cap that holds the batteries is.The cut was made on the area that there is a small rubber strip, for the keyboard to rest. I had to make the cut slit long enough to almost the center plastic area of the bluetooth compartment. With a screw driver I opened the slit a little where the screw cap is and I was able to remove the cap. Next I opened the slit a little bit all along and a could see the battery closer to where the cap is had leaked acid and corroded some of the inner aluminum tube of the keyboard.
I inserted a nail through the slit into the battery and pushed it out with a few strokes of the hammer.
I cleaned the corroded area, bent back with pliers the slit of the keyboard, sanded lightly the outside of the slit, filed the inside corrosion with a round metal file, placed the batteries and screw cap and the keyboard is back to life working as usual with the Imac. You can cover the slit with a self sticking rubber strip purchased at a nearby hardware. Good luck.