Improve tabwidget state saving
Previously, state saying was handled by a function being called in the destructor.
The destructor is typically only called when Kleopatra exists cleanly. When closed in other ways,
the state would thus not save, resulting in a subpar user experience. This patch changes it
to save whenever a relevant value changes.