In an agreement with Mr. Icahn, the activist investor, Xerox said it would spin off its services business by the end of the year.