[TASK] Catch errors in the flush() method of the CouchDBHelper

The CouchDBHelper->flush() method is called on every controller
invocation causing a fatal error on every call to a controller
if there's no connection to the database.