Some people fill the gaps with foam or trim cut to fit. We have a MUCH larger gap to fill of appx 6" (DH went overboard on making sure there was room to maintain things) so will actually have a "finish" board that overlaps both the top rail and header/last board on the deck - there is a hinge on the board at the deck side so that it flips up to leave the gap open for maintenance like dealing with the winter cover, removing rails, etc.