Solved! Go to Solution.
There is no API script function to close a diagram.
Why is there not a symmetrical fonction Open? Because the function Open has been developped for test and demonstration purposes.
I will check this information in case something has changed recently.
I can confirm there this no function close a diagram with API script.
You can consider to close the diagram by closing the corresponding running object.
Note that this should be done very carrefully