The bridges are very low at certain times. If they did not close the top deck it could be very dangerous people could get hurt badly. Sometimes they barely pass under the bridges.
The "wheelhouse" on the ships in on a hydraulic lift and also goes up and down when they are in areas of low bridges so it can be flat with the sun deck during these times. This happens even if the water is not high.
With really high water often they cannot go under the bridges at all and river boats get "stuck".