In the event any such school is permanently discontinued, as provided for in Section 37-27-83, the board of trustees of such school and the board of supervisors of the county in which such school is located, are further authorized to transfer to the county common school fund of the county all funds on hand in the county treasury or depository to the credit of such school, including all maintenance funds and other funds belonging to such school. In case the school thus discontinued shall be a joint school maintained by two counties, as now provided by law, the school funds belonging to such school and the proceeds derived from the sale of school property shall be divided between the counties interested in proportion to the amount of funds contributed by each county to the establishment and maintenance of such school.