(5)The commanding officer shall, out of the moneys so received, collected or realised under sub-sections (1) and (3), pay the ship and service debts and other debts in ship or quarters of the deceased, and the expenses incurred in connection with the realisation of the assets of the deceased.