Any surplus in a sinking fund after all of the bonds for the payment of which the fund was created have been paid and canceled and after all investments of the second and third class finally have been disposed of or realized upon, must, within two years, be placed in the general fund of the municipal treasury.