---
title: "close(_:context:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/datacachehandler/close(_:context:replyhandler:)"
---

# close(_:context:replyHandler:)

Closes an item and releases associated cache resources.

## Declaration

```swift
func close(_ item: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable () -> Void)
```

```swift
func close(_ item: FSItem, context: FSContext) async
```

## Parameters

- `item`: The item to close.
- `context`: An object that enables context-aware file system decisions throughout the operation.
- `reply`: A block or closure to call when the close operation completes.

## Discussion

Discussion FSKit calls this method when fully closing a file, and after the kernel finalizes all caching for the item. Your module receives this call once per item when all references are released and the kernel has completed its cache management. The module performs any necessary cleanup operations for the item. note: This method doesn’t return or throw an error because the OS considers the file closed regardless of whether the module encounters any issues during cleanup.

## See Also

### Opening and closing items

- [open(_:modes:cacheMode:context:replyHandler:)](fskit/fsvolume/datacachehandler/open(_:modes:cachemode:context:replyhandler:).md)
- [FSOpenItemResult](fskit/fsopenitemresult.md)
- [FSVolume.DataCacheMode](fskit/fsvolume/datacachemode.md)
- [FSContext](fskit/fscontext.md)
