A written agreement between any local agencies made and ratified prior to January 1, 1981, by the respective legislative bodies of both local agencies and providing against the closing of streets or highways described in Section 8360, except in accordance with the terms of the agreement, is hereby ratified and declared valid.