A VI is released from memory when a) its Front Panel is closed AND b) no running VI has a reference opened to the VI.
A VI can stay running in memory with its panel closed when it opens a reference to itself. The exeption is in a Run-Time executable, where the apllication quits when all VI Panels are closed.