<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryAccess",
  "identifier" : "/documentation/AccessoryAccess/AAUSBAccessory/close(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accessory Access"
    ],
    "preciseIdentifier" : "c:objc(cs)AAUSBAccessory(im)closeWithCompletionHandler:"
  },
  "title" : "close(completionHandler:)"
}
-->

# close(completionHandler:)

Closes all connections to the USB accessory for this process.

```
func close(completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```
func close() async throws
```

## Parameters

`completionHandler`

A block the framework calls after the client has successfully closed the USB accessory. The error parameter the framework passes to the block is `nil` if the operation was successful. The framework invokes the block on an arbitrary thread.

## Discussion

> Warning: Closing an accessory by calling the `destroy()` method on an <doc://com.apple.documentation/documentation/IOUSBHost/IOUSBHostDevice> is a blocking operation. Such an operation causes a deadlock, if you call it from a completion handler.

This operation closes the USB accessory, that the app previously opened through [`open(serviceQueue:completionHandler:)`](/documentation/AccessoryAccess/AAUSBAccessory/open(serviceQueue:completionHandler:)). Once this operation completes, the framework invalidates any <doc://com.apple.documentation/documentation/IOUSBHost/IOUSBHostDevice> object it previously returned and you can’t use it for USB transfers. This operation has the same effect as calling the destroy method on <doc://com.apple.documentation/documentation/IOUSBHost/IOUSBHostDevice>.

Once the app closes the accessory, the app can re-open the accessory using this process or any other worker process of this client application for exclusive access using [`open(serviceQueue:completionHandler:)`](/documentation/AccessoryAccess/AAUSBAccessory/open(serviceQueue:completionHandler:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)