I've spent the last hours looking into this, but unfortunately I was not able to find a satisfying solution. The autosave is writing around 400 characters to the cookies every second, which shouldn't really cause problems under normal conditions.
Many browsers allow you to run some code before a window is closed, unfortunately they don't allow enough time to actually save anything. As a result the only way I can ensure progress is not lost, is to autosave frequently.