Record close PLM event (fix #301)

Also prevent from quitting with uncommitted changes
thus making fail the merge at startup