It looks like another process was using apt and had added a lock file. If you have your system set up to auto update - it may be that it was updating in the background?!
That's been a problem for me in the past on Debian. Whenever I decided I wanted to install/uninstall something - I'd discover that apt was locked because the automatic updates were running in the background and had set the apt lock. Which meant having to wait until they'd finished before I could do what I wanted to do. Which got old very quickly. So I just disabled the automatic updates. I always update manually now!
Or perhaps you had the Pop-store open and it was installing something?
Again, in these sorts of cases, the best thing to do is wait for the process using apt to end and the lock file should automatically be removed, allowing you to use apt in the terminal again.
The lock files can also be left hanging around if you forcefully killed an apt process before it had finished - or if apt has crashed, or the system has crashed, or powered down during an install/uninstall.
The best thing to do is to check for any processes that are running apt and then wait for them to finish. It's not usually an idea to forcefully stop them unless you absolutely have to.
If you're sure that nothing is currently running apt, then it should be safe to remove the lock-file. That will remove the lock and will allow you to use apt again. But if the lock-file was left behind in one of these types of scenarios - you may encounter other errors, because it usually means that a previous run of apt had failed which is why the lock was not removed.
Usually in that situation - apt will suggest a command to run in order to cleanly finish whatever the previous operation was.
So you might have to run a dpkg command, or an apt command in order to clean up after whatever went wrong, before being able to use apt normally again.
The only times I've had problems like this with apt have been if my laptop battery ran out during installation of something. Which isn't actually a problem with apt, it's more a problem with me not watching my battery percentage and not managing to plug my laptop in before it powered off! Ha ha!