> ## 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 Closing Project

> Intercept project closing with the On Closing Project event, which runs before the FlexiCapture confirmation dialog and can keep the main window open.

## When it is launched

The script is launched when the project is being closed and prior to showing an inquiry dialog. The inquiry box appears if the user must confirm the action before proceeding.

* If the **CanClose.Value** property is set to **false**, the main window will remain open.
* If the **CanClose.Value** property is set to **true**, the main window will be closed.

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 main window |
| Context  | [IMainWindow](/flexi-capture/appendix/scripts-shell/imainwindow) | Read/write | The main window                            |
