Implement caching for thumbnail files.

BUG: 321437
Apply workaround for current crash-on-exit problem.

CCBUG: 323387