Fixed temporary history file deletion bug