Editing a saved note can no longer damage another one

Three separate data-loss paths in the history save were found and fixed: saving an edited note could overwrite a different note, silently drop an edit on an older entry, or report success on a write the database had refused.