Exit editing mode when view will disappear

#957 fixed