Upon the inclusion of all the territory of a district in one or more cities, either by reason of annexation or by reason of the incorporation of one or more cities, all funds paid into the county treasury to the credit of the district shall be paid over by the board as provided in this article.