---
title: willFinishRunning()
framework: automator
role: symbol
role_heading: Instance Method
path: automator/amaction/willfinishrunning()
---

# willFinishRunning()

Provides an opportunity for an action to perform cleanup operations, such as closing windows and deallocating memory.

## Declaration

```swift
func willFinishRunning()
```

## Discussion

Discussion Overridde this method in actions that need to make asynchronous calls. Automator invokes this method when the action is about to complete its run phase.

## See Also

### Controlling the Action

- [run(withInput:)](automator/amaction/run(withinput:).md)
- [runAsynchronously(withInput:)](automator/amaction/runasynchronously(withinput:).md)
- [finishRunningWithError(_:)](automator/amaction/finishrunningwitherror(_:).md)
- [stop()](automator/amaction/stop().md)
- [reset()](automator/amaction/reset().md)
