When you compact a db, Acces creates a new file "db1.mdb" in the same directory as the original db is in and compacts that new db1.mdb file. Then it deletes the original db and replaces [renames] the db1.mdb file with the original name of the db. That is why the db1.mdb file is sometimes left behind if Access was able to successfully compact the db. That way you do not loose the original.
My bet is that your password protected db is asking for the password the second time because it is reopening itself after the compacting. I would be curious to know if the db1.mdb file is still in the same folder as the original db when you are asked for the password [before the file replacement is made]. I am still using Access 97 so I can not test this for you.
Password protecting you db is not the best way to keep the unwanted folks out since there are so many freebie programs in cyber space that will crack your db is a second. You should work with your network security folks to have the directory that the db is located in "secured" so that only the folks you want to use you db can access the directory that you db is located in. They must have read/write/delete permissions to propery use the db.
HTH