Improve lock/unlock assurance flow.

[FIXED]     Bug that caused the window to sometimes re-open when closed.