CLI: fix saving and loading history file