Fix bugs found while testing
 - Running is set to false even if no docs saved.
 - notifyObserver() called at right time.
 - db = null set at correct time as per original code.