compute the history file path at the beginning

this avoids problems if the user calls chdir()