The first one was too high for him. He couldn't get over the ball to head it down. If it had been on the ground, then that would have been a sitter, but he leaped up and still could not get his head over the ball. His height betrayed him there, if he was a bit taller that would have been an goal.
The other header again was high for him, and he still had to loop it over the keeper. The chance at the end was a good save. The chipped chances he was offside, but the ball also bounced really high off the grass and the keeper reacted quick to shorten the space so Messi had to rush it.
I won't argue he is not as sharp as he used to be with his finishing, because this is true, but many here bemoaning his finishing are really overdoing it. He has been very unlucky lately.