Gonaçalves narrowly misses podium at Latvia Grand Prix