dpkg: error: dpkg status database is locked by another process - SOLVED

Begin with:

lsof /var/lib/dpkg/lock

Then check if the process is running:

ps cax | grep PID

If the process is running, execute the following command (replacing PID with the output PID) to kill it:

kill -9 PID

Ensure that process is done:

ps cax | grep PID

Remove the lock file:

sudo rm /var/lib/dpkg/lock

Configure DPKG to continue with failed installation as a result of the lock

sudo dpkg --configure -a

Credit to Pooyan