Gets the lastest history-entry that has been added and removes it from the history.
if called on an empty history.