The Mishne Lemelech Hilchos Aveilus 14,21 says about benefiting from a dead body:
אסור בהנאה משום דאתיא שם שם מעגלה ערופה והיא הלכה פסוקה כתבוה כל הפוסקים ז"ל ובכל איסורי הנאה המכירה היא אסורה מדין תורה דהא איצטריך הכתוב להתיר נבלה בהנאה -
It is forbidden to have benefit from the dead body from the Torah as we learn a Gezeira shava "Shom Shom" from Egla Arupha to Miriam's corpse -
unanimously agreed by all the Poskim and this includes selling the body.
This means that the dead body does not have an owner as it is forbidden for benefit as the Ramban and Rashba say in Pesachim 4a:
"אין זכייה באיסורי הנאה"
in which case one has no right to "sell the rights" of this body to a gentile or anyone.
The Gemoro Shevuos 27a says:
מתני: נשבע לבטל את המצוה ולא ביטל פטור -
One who swears to annul a Mitzva and did not annul that Mitzva is exempt.
It is clear that if the stipulation was a promise it is not binding if it goes against the Torah prohibition of having benefit from a dead body like take limbs to study them for medical records.
if the stipulation was contract bound, one does not have to fulfill the contract which because by doing so he is listening to a student (the gentile who is telling him to provide the body for autopsy) instead of The Teacher (Hashem who commanded us not to profane dead bodies).Source Kiddushin 42b אין שליח לדבר עבירה דאמרינן דברי הרב ודברי תלמיד דברי מי שומעים.
So there is no doubt that you should fly the dead body over to Israel before it is defiled if you can.
However even if it is not possible to retrieve the body and it undergoes an autopsy, then you did the right thing which is to try and save the persons life before they died through this experimental treatment, and this overrides the prohibition of defiling the dead body as it says ְְin Avoda Zoro 27b: "וחי בהם"-- לא שימות בהם" -You should live by the mitzvos, and this Aveira is pushed aside in the face of saving a life. It's just if you can get the treatment and deport the body away from being defiled, you cannot be lazy and say it's הותרה because one should always do as little transgessions as possible. This follows the Rema in SA OC 328,12: >הגה: ויש אומרים דאם אפשר לעשות בלא דיחוי ובלא איחור על ידי שינוי עושה על ידי שינוי -.
I.e whatever you can do to avoid prohibition even in a case of pikuach nefesh should be done provided this does not affect the person in danger.
P.S Unfortunately, Your predicament is common-place in France, as there is a law for French citizens that if they die in hospital, their body is detained for 3 days for a post-mortem. Rabbi Goredetski who is the head of a Chabad house in Place du Temple in the 11th arrondissement of Paris told me that they have to use connections with the hierarchy of the hospital in order to let the body go prematurely in order to bury it as soon as possible without defiling the body as per Halacha.