Teachers agree on new pact