Erase until the path history is empty