If you select a new command, the previously selected command will be aborted.
You can also abort the active function by clicking the close button on the function panel, by pressing Esc or by right-clicking and selecting the Cancel [Function Name] option.