Never close the door.
How to do it properly. I was offered early retirement from $BigCo for lacking both personal qualities of which one was a minimum requirement to deal with management: the ability to suspend disbelief and the ability to conceal disgust. Anyway, good terms were agreed - finish at end of year, several months away and best possible terms under IR regulations so no hard feelings either way.
Of course under these circumstances one gets lumbered with the odd project nobody wants, in my case one which had come down from national management. I would do phase one & my line manager would then take over for phase two.
So at the year end I started off for what turned out to be 10 years freelance. This got off to a good start because a few weeks into the year when I'd just got the first short contract finished when they rung up. Line manager was leaving, would I come back on contract & do phase two? After phase two there was a follow-up to start on the no-longer-project-but-new-business-as-usual work until some victim could be found to off-load it onto.
So, because everything was done in a friendly fashion I got 6 months freelance work & $BigCo got its work done.