# CloseCachedFileAsync(string, JobHandle)

> Closes a file held open internally by the AsyncReadManager.

## Definition

* **Type:** Method
* **Namespace:** [Unity.IO.LowLevel.Unsafe](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public static JobHandle CloseCachedFileAsync(string fileName, JobHandle dependency = default)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The path to the file to close.**** (\[JobHandle]\(/engine/6000.3/script-reference/unity/jobs/jobhandle)): (Optional) A JobHandle to wait on before performing the close.

### Returns

| Type                                                                 | Description                                                                |
| -------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [JobHandle](/engine/6000.3/script-reference/unity/jobs/jobhandle.md) | A JobHandle that completes when the asynchronous close operation finishes. |

### Remarks

The AsyncReadManager has an internal cache of up to 10 open files, so use this method if you experience a sharing violation when trying to access one of these files that is held open.

Note: Do not use this method for files opened with [AsyncReadManager.OpenFileAsync](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/asyncreadmanager/openfileasync.md), as these files do not go into the AsyncReadManager's file cache. Use [FileHandle.Close](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/filehandle/close.md) instead.
