US retailer A&P has finally secured the takeover of regional chain Pathmark Stores.