A $40 million deal will keep a 17-acre site on the Lynnway in Lynn in industrial use at a time when other parts of the stretch of the North Shore city are turning over into residential use.