Zend certified PHP/Magento developer

zsh history is not syncing immediately

I have zsh 5.7.1 (x86_64-apple-darwin19.0.0) and using iterm2 if it makes a difference with the following zshrc:

HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

The file ~/.zhistory isn’t populating if I enter any commands.
The file is appended only if when I exit from zsh:

echo r3d3
cat ~/.zhistory |grep r3d3 # shows nothing
zsh
echo r2d2
exit
cat ~/.zhistory |grep r2d2 # only this way it will print r2d2

This makes it impossible to use commands like hstr. And if a terminal crash I lose my history