The Daily Mail’s publisher “knew they had skeletons in their closet”, lawyers acting on behalf of the Duke of Sussex and others have told a court.