wallet: don't forget to close the file after storing cache
wallet: don't forget to close the file after storing cache

Also add some flags to open, as epee's save_string_to_file does,
to truncate file, etc.

eiabea/bitmonero,ranok/bitmonero,eiabea/bitmonero,eiabea/bitmonero,ranok/bitmonero,eiabea/bitmonero,ranok/bitmonero,eiabea/bitmonero,eiabea/bitmonero,ranok/bitmonero,ranok/bitmonero,ranok/bitmonero