At least in the DOS version of BT1 (haven't checked the 2gs version on this detail):
When you add a character to the party, the game sets the on-disk gold of the character to 0. (This is done to try and prevent "cheating" by turning off the game if something bad happens, but I disagree that one should try to prevent this.)
When you remove the character from the party, the game saves the character's stats, including gold, to disk.
Therefore, you should make sure to remove your characters from the party (or use the in-game quit option, which automatically removes your entire party) before you close the game.
Note that there may be some shenanigans that allow you to duplicate items this way.
Also, note that BT2 and BT3 got rid of this anti-"cheat" measure, but still save individual characters. On the other hand, you can save the game away from the guild, which is a separate save that doesn't update the versions of your characters in the Guild; this is exploitable for things like character/item duplication (though using monsters for item duplication is faster).
Anyway, remember to remove your party at the guild before closing the game.