If your friends like to cut it close then be prepared to wave goodbye from the pier. They will NOT wait for you under any circumstances.
We were on Carnival Pride this summer and 21 people were left behind in Cozumel, meaning they had to find transportation back to Port Canaveral on their own since the final day was a day at sea. Not only that, but we left Cozumel two hours early because a hurricane was coming through. So I'm sure they couldn't get a flight out that day and had to find accommodations during a storm. Don't worry, Carnival warned everyone continuously over the two previous days that they day would be shortened.
If the ship leaves at 5 p.m., you are required to be onboard at 4:30 p.m. Frankly, anyone who wants to cut it close by 10 minutes deserves to be left behind. You never know when traffic or something else might delay you.
Personally, I like to be back onboard an hour before we set sail. The expense of airfare to the next port has to be very expensive.