Avoid static local of a singleton.  This crashed writer unit tests.

Change-Id: I7c5f2d372676cdb317a8dad636bf1aab7dd5db37
(cherry picked from commit 5a827671d16ff5e927fc3dd4a01e6c32ea05d891)
Detach all DocBasicItem objects upon process termination.

To prevent rogue DocBasicItem objects (which are global objects) from
attempting to stop listening after the main app is dead.

Change-Id: I68a667137ca4e0eff18278f4d2d5dd67466eaf34
(cherry picked from commit a916b6ff7fdf1bcb1182e72e4a5bf2f901c698da)