BTree frequency update bug

Fixes for making sure that updates to frequency are written to file
which was not occurring in noncache versions of the program.