# Kernstra.destroy()

```ts
static destroy(): void
```

Tear down the SDK and free its resources. Destroy your viewers and close your documents first (each viewer terminates its render worker): with a document still open it throws `INVALID_STATE` rather than free them from under it.

After an `ENGINE_FAILED` fault it tears down whatever is open — that is the recovery — and a document closed after it is already released, so its `close()` does nothing. `destroy()` removes the `onLicenseChange` subscriptions, like every other SDK listener; `Kernstra.events` subscriptions are kept across it.

- Kind: static method
- Since: 1.0.0

Returns `void`

Throws:

- `INVALID_STATE` — a document is still open.

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

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

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