UK bakery group Hovis has struck a deal to sell two of its mills and outlined plans to close another.