WIP: trying to fix cookie weird behavior on close