The history will not be written if either the shell/OS crashes, or if you `unset HIST_FILE` before exiting the shell.
I figured I'd learn something by putting in the "I'd love to know others" bit, but this is something I didn't know I could do, and is genuinely useful to know!