When you run a software installation command (e.g., aptitude, apt-get, synaptic or the Ubuntu Software Centre), the file /var/lib/dpkg/lock is locked to prevent several instances of the command to run concurrently. The reason to do this is that software installation has to modify vital system files, and concurrent modification may result in some changes not being applied or -worse- in corrupted files.
Although the dpkg package installation system used in Debian and Ubuntu is quite robust and will do the right thing even if an installation is canceled or interrupted, it is usually safer to let the installation finish and then remove the installed package afterwards.