> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# On Task Close

> On Task Close runs before the current FlexiCapture task closes; scripts can keep the task open by setting the CanClose parameter to false.

## When it is launched

The script is launched prior to closing the current task.

* If the **CanClose.Value** property is set to **true**, the task will be closed after the script execution.
* If the **CanClose.Value** property is set to **false**, the task will remain open.

By default, the value of the **CanClose** parameter is **true**.

## Parameters

| **Name** | **Type**                                                         | **Access** | **Description**                     |
| -------- | ---------------------------------------------------------------- | ---------- | ----------------------------------- |
| CanClose | [IBoolean](/flexi-capture/appendix/scripts-shell/iboolean)       | Read/write | Specifies whether to close the task |
| Context  | [ITaskWindow](/flexi-capture/appendix/scripts-shell/itaskwindow) | Read/write | The task window                     |
