---
title: close()
framework: avfaudio
role: symbol
role_heading: Instance Method
path: avfaudio/avaudiofile/close()
---

# close()

Closes the audio file.

## Declaration

```swift
func close()
```

## Discussion

Discussion Calling this method closes the underlying file, if open. It’s normally unnecessary to close a file opened for reading because it’s automatically closed when released. It’s only necessary to close a file opened for writing in order to achieve specific control over when the file’s header is updated. note: Once closed, further file read or write operations fail with a kAudio_FileNotFoundError.

## See Also

### Reading and Writing the Audio Buffer

- [read(into:)](avfaudio/avaudiofile/read(into:).md)
- [read(into:frameCount:)](avfaudio/avaudiofile/read(into:framecount:).md)
- [read(frameCount:)](avfaudio/avaudiofile/read(framecount:).md)
