Save command history before each prompt