Fix enforcement of shutdown timeout

The Buffers#waitForEmptyBuffers and Caches#waitForEmptyCaches methods ignored the
configured shutdown timeout and always waited for empty buffers/caches for 30 seconds.

Fixes #729