Behave better when opening over a buffer with unsaved changes

Fixes issue #52