IC & TS: allow complete destruction of the shared ImageCache.

Previously, destroy() would fully delete a non-shared IC but in the
case of the global "shared" IC would just do a cursory invalidate of
the files.

This patch adds a parameter to the destroy() methods that, if true, will
do an even more thorough destruction of the underlying IC -- a full
invalidate_all(true) followed by releasing the shared pointer and (when
nobody else is still holding it) fully destroying the IC.

Default behavior doesn't change, but you can use this parameter to force
a full destruction of the underlying IC, even if it's the "shared" one,
for apps that want to be completely sure that they fully reclaim the
memory and all other resources held by the IC.