The lock file /var/lib/apt/lists/lock could not be accessed

If you get the following error when executing commands with apt-get:

E: Unable to access the lock file /var/lib/apt/lists/lock - open (11: Resource is temporarily unavailable)
E: Unable to block directory /var/lib/apt/lists/

To get rid of this error, just remove the lock

rm /var/lib/apt/lists/lock

Such an error occurs if you close or cancel (Ctrl + C, Ctrl + Z) the execution of any of the apt-get commands.