Fix bad memory access

We wrote to instance data after potentially having been released.
Bundle editor was holding an untitled counter

This meant after opening the bundle editor the next untitled document created would have a number prefix one higher than expected.