Even though you may be on the airplane, there is still a lot of work that needs to be done before the aircraft can leave the gate. The main reason why boarding stops 10 minutes before departure time is so that the crew can ensure an accurate passenger count. Knowing how many passengers are on board is critical for computing proper weights and takeoff setting for the flight crew. In addition, new TSA regulations have made it a security violation for an aircraft to leave the gate without an accurate count of all passengers on board and a manifest of who is on board.
Sometimes if the agent knows that a few people will make it very close to departure time because of late connecting flights they will advise the flight crew to expect them, thus attempting to minimize the time it takes for them to become situated on board. However, you should always make it to the gate at least 15 minutes prior to departure (preferably 30+) to ensure your boarding goes smoothly. Those last minute meals or last drink at the airport bar may cost you your trip.