Exit editing mode when view will disappear

#957 fix
Merge pull request #1011 from intoxicated/issue/957-Exit-editmode

Exit editing mode when view will disappear