Added close method to CachingMiddleware.

Seems there is missing method for the CachingMiddleware.
And with using of JSONStorage db.close() and 'with' section doesn't work correctly for me.