Added additional check on close.

Prevents double-prompt in a special case.