Fix cut/paste error in close event