First thing check the fuses in the fuse box are all intact, since you had work on the door lock and a battery change its possible some fuses have blown. Scan the car and see if its set any fault codes that might lead you in the right direction to solve this. Its also worth noting that if the battery gets low the car puts itself into Transport mode and closes down some of the cars electrical syatems to conserve power for starting. Systems that usually get closed down are Aircon, Radio and heated rear window. Transport mode has to be reset using diagnostic software, BMW Scanner 1.4 on a laptop can reset it to normal mode. As to windows only working with doors open maybe they need syncing, hold the window down button all the way down till the window stops at the bottom pause for five seconds then hold the up button up till the window stops at the top, pause and release then see if it works with the door closed.