My name is Hideaki Hagiwara in Japan.
I found a little defect at Order document(Both PO and SO).
When Order document close before Shipment or Receipt, Grand total of Order remains tax amount only.
See attachment file1.
So,I think that MOrder.closeIt() method should calculate tax again.
See attachment file2.
thank you for reading.