A local agency may, by written contract, agree with another local agency that a street or highway running from either of the local agencies to, in, through, or across any incorporated territory of the other local agency may only be closed or vacated by the other local agency upon the consent and agreement of both local agencies.