[CXF-5842] Make sure the cache gets cleaned up if it fails to cache the input