Hi,
That does sound very odd that it is saving some and not others.
I don't find I lose anything if the chat is left "open" even if I close the App itself.
I have thought at time that if I look in the /Messages/Archive folder that it does not seem to always have the Chats that I think it should.
Checking further normally mean I find the Save Setting has been turned Off.
If for some reason you did not Own the ~/Library or the Messages or indeed the Archive folder itself then the problem would occur all the time and not be intermittent as you describe.
Navigate again to the ~/Library/Messages folder at least.
Highlight the Archive folder then do a Get Info (CMD and i keys together)
At the bottom of the Infio panel you should be list (as the Mac User Shortname) and have Read and Write Permissions
Highlight your Name then use the Cogwheel icon under the list.
If you Own the files this will list your shortname again and it should be greyed out (As in "Make shortname (Me) the Owner") has already been done.
Whilst in the Messages folder go to the Finder > View Menu and Show View Option and use the Show Path Bar if you have not already done so.
Right Click on the Messages item and select Get Info for that folder from the Contextual Menu
Repeat for the Library Itself.
Example pic actually of the Library folder
7:57 PM Tuesday; June 4, 2013
iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.3)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad
"Limit the Logs to the Bits above Binary Images." No, Seriously