Modified BTreeWriter to rewrite only a key's frequency when possible