Safety Insurance Group agreed to be acquired by an affiliate of Mapfre in an all-cash deal valued at $1.54 billion, or $105 per share. The transaction, which has board approval, positions Safety within the global firm while maintaining its New England operations.