General Motors has reached an agreement to sell its stake in a nearly completed electric vehicle battery plant in Lansing, Michigan.