UFCW Local 791 and Shaw’s Supermarkets Inc. have signed a new five-year contract, avoiding a potential strike by 5,600 store and warehouse workers in New England states. The agreement was reached following a marathon overnight session with the help of a federal mediator.