close logic fix