Fix exception on editor closing