OP, the process is mentioned by @Caldera earlier....the termination letter is dated in future.
Also explained in this cut/paste from ubonjoe in older thread...
"Immigration will post date the cancelation to the day on a termination letter from your employer to give you time to leave the country. If not you would be on a overstay when you leave the country."