Lock edit mode when there are dirty items