Fix fix cookie weird behavior on close