Section 2. After the payment of all debts for which such estate is liable in this commonwealth, the residue of the personal property may be distributed and disposed of, as provided in the preceding section, by the probate court; or, in the discretion of the court, it may be transmitted to the executor or administrator, if any, in the state or country of which the deceased was an inhabitant, to be there disposed of according to the laws thereof. But nothing herein shall be construed to prevent the distribution or transmission of part of the personal property of an estate in process of settlement when it can be done without detriment to the estate or prejudice to the creditors.