Dpkg: error: dpkg status database is locked by another process

dpkg: error: dpkg status database is locked by another process E: Sub-process /usr/bin/dpkg returned an error code (2)

Got this error after “sudo apt-get update && sudo apt-get dist-upgrade”.
I repeat command again and it seems finished update without errors.
How to make sure that everything is good ?

No error messages = good.

Check the exit code.

sudo apt-get update
echo $?

sudo apt-get dist-upgrade
echo $?

0 = good.

Thanks