Fix a problem when cancel the addition of a map element in the MapEditor by closing the window (not by the cancel button).