Close State/Transition edition on SM close

* Fix #635