Its not a matter of seconds, its a matter of energy you spend. At 1km to go he was the last of the group, he had to spend a lot of energy to come to the front. Energy that he didnt have to respond Alaphilipes attack.
And then, once you dont have the chance to win you dont push the same. He just looked to get the third spot of the podium.
I don't know if he would have been able to beat Roglic or Alaphilippe, but he would have been definitely closer. About 600 m from the finish line he still had to surpass about 10 riders to even get to Roglic's wheel. My rough estimate when re-watching is that he was about 2 seconds behind Roglic at this point.