# Orphaned Windows After Removing Apps via In-Memory Import with Replace Mode

**URL:** <https://community.interop.io/t/orphaned-windows-after-removing-apps-via-in-memory-import-with-replace-mode/612>\
**Category:** io.Connect Desktop\
**Tags:** iocd-9, Tip\
**Created:** [June 26, 2026, 8:42am UTC](https://community.interop.io/t/orphaned-windows-after-removing-apps-via-in-memory-import-with-replace-mode/612 "2026-06-26T08:42:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![toni.petrov](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.interop.io/toni.petrov/32/17_2.png) [@toni.petrov](https://community.interop.io/u/toni.petrov)\
**Post date:** [June 26, 2026, 8:42am UTC](https://community.interop.io/t/orphaned-windows-after-removing-apps-via-in-memory-import-with-replace-mode/612/1 "2026-06-26T08:42:48Z")

</div>

## Problem

When using `io.appManager.inMemory.import()` with `'replace'` mode to dynamically swap app definitions, if the new set of definitions does not include a previously running app, the app instance is removed from the App Manager, but its window remains open on screen.

Attempting to close the orphaned window manually after the import throws an error in the console.

## Solution

A configuration property was added under `system.json` to control this behavior:

```auto
"closeRunningInstancesOnAppRemoved": true

```

- **Type:** `boolean`
- **Default:** `false`
- **Description:** If `true`, all running app instances will be closed when the app definition is disabled or removed.

When set to `true`, running app instances are closed when the app definition is disabled or removed, which also closes the associated windows without causing errors.
