close method
Frees what the model holds: its GPU buffers, its worker isolates and its mappings of the weight cache and model.safetensors, in that order (the GPU wraps the cache). Afterwards the model throws StateError. Matrices quantized at load time, without a cache, stay allocated: only the command-line tool loads that way, and it exits.
Implementation
Future<void> close() async {
if (_closed) return;
_closed = true;
_gpu?.dispose();
await _executor?.close();
_cache?.close();
_embedFile?.release();
}