What were the holes or windows on the side of the submarine?
They are called limber holes. They allowed the empty space below the deck and above the pressure hull to flood and drain quickly. They allowed the crew to dive the boat in 30 seconds or less and to surface quickly. Without the limber holes, the air and water would push against each other trying to get through the openings in the deck and neither would move efficiently.
Instead, when they submerged the boat, the water flowed into the empty space through the limber holes and the air escaped through the various openings on the deck. When the boat surfaced, the opposite occurred with the water flowing out of the limber holes and the air filling the space through the deck.
When submerged, the limber holes did add drag to the boat. A smooth superstructure would have been more efficient. However, the ability to dive quickly was more important.
Modern submarines do not need limber holes since they dive only once and remain submerged most of the time they are at sea. They also do not have all the open space between a deck and the pressure hull that would need to fill with water.