After four days of talks that seemed shaky at times, EU leaders have agreed to a historic coronavirus recovery deal.