Reduced calls to db:flush() to reduce stuttering

Added a flag to track if the options db needs to be updated, this
reduces the number of calls to db:flush() while navigating the options
menu, thus reducing the Options UI stuttering.
Addresses Issue #1269.