# PDFDocument.close()

```ts
close(): Promise<void>
```

Close the document and free its resources; resolves once they are released. A viewer still open on it refuses undo, redo, `snapshot()` and Download with a reported `DOCUMENT_CLOSED` (its exporter rejects with it): destroy the viewer, or open a new document. After `Kernstra.destroy()` has recovered from an `ENGINE_FAILED` fault the document is already released, and `close()` does nothing.

- Kind: method
- Since: 1.0.0

Returns `Promise<void>`: Resolves once its resources are released.

```ts
viewer.destroy();
await doc.close();
```

Part of [PDFDocument](https://kernstra.com/docs/web-sdk/api/pdfdocument) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/pdfdocument/close
