If, at the close of any fiscal year, a balance remains in any State Treasury fund, fund account, or account which is subject to transfer at the close of a fiscal year, and into which both general revenues and either special revenues, nonrevenue receipts, or federal reimbursements are deposited and expended, the special revenue portion of the balance shall be the proportion that the amount of special revenues credited to such fund or fund account is to total funds credited to the fund or fund account in each fiscal year. The special revenue portion of the balance shall be carried forward to the next fiscal year and shall be used solely for the purposes for which it was collected as provided by law.