There might be several reasons for the water heater pilot to go out. Since you’ve mentioned that opening of the window prevents the WH burner pilot from being extinguished, it seems like there’s no sufficient combustion air supply for the area your gas burning appliances are located in.
Also, your HVAC system supply and return ducts / register openings may not be balanced properly (not enough return ports), and / or returns have been positioned in such way, that they are (whenever the HVAC system kicks in) sucking the air from the exterior / through the WH’s vent pipe / draft hood.
This sometimes happens if the HVAC system return port has been installed next to the combustion chamber (burner area) – minimum 10' distance between the air return and combustion chambers is required – assuming that you have sufficient combustion air supply to that area.
As far as the water heater vent flue pipe size, the requirement for two water heaters using a common vent pipe is that the vent pipe diameter starting from the connection of the water heater closest to the discharge end must be the size of the largest draft hood + 50% of the smaller draft hood diameter.
If both water heaters have a 3" diameter draft hoods, 4" diameter vent pipe is too small – you’d need a 5" diameter vent pipe (I don’t think they make 4.5"). For two 4" diameter draft hoods, the common vent flue pipe diameter would have to be 6". However, those calculations also depend on the number of bends / elbows installed on the vent pipe, and tables usually supplied with the water heater should be used for exact calculations.
If your water heaters are standing next to the chimney, up to two 90° elbows (as an offset) are permitted before they enter the chimney without using the tables.