---
title: close()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsdocument/close()
---

# close()

Closes all of the document’s windows and removes the document from its document controller.

## Declaration

```swift
func close()
```

## Discussion

Discussion This method closes the document immediately, without asking users if they want to save the document. This method may not always be called.

## See Also

### Related Documentation

- [shouldCloseWindowController(_:delegate:shouldClose:contextInfo:)](appkit/nsdocument/shouldclosewindowcontroller(_:delegate:shouldclose:contextinfo:).md)

### Closing the Document

- [canClose(withDelegate:shouldClose:contextInfo:)](appkit/nsdocument/canclose(withdelegate:shouldclose:contextinfo:).md)
