[BZ-1066199] ensure stream close on UrlResource.cacheStream()