Yes - the decision was at least correct by Law, and most likely fair as well. The referee is the sole arbiter of timekeeping, as shown in the following Laws.
Law 5 - The Refereee, Section 3 - Powers and Duties:
The referee:
- acts as timekeeper, keeps a record of the match and provides the appropriate authorities with a match report, including information on disciplinary action and any other incidents that occurred before, during or after the match
Law 7 - The Duration of The Match, Section 3 - Allowance For Time Lost:
The fourth official indicates the minimum additional time decided by the referee at the end of the final minute of each half. The additional time may be increased by the referee but not reduced.
If the referee had decided that the amount of additional time added on had compensated for time lost during the second half, they were correct by Law to stop play.
Now, as to the question of the decision being fair - some referees may decide to "find" a few more seconds if there is a promising attack, since the time added on is generally a very rough estimate. This generous helping of a few extra seconds is acceptable to most referees.
However, the longer play is allowed to continue after the initial allotment of additional time, the unfairer this is on the defending team. If a team has had 90 minutes plus additional time (along with a few seconds more) to score - why should the other team be placed at a disadvantage by allowing even more time?
In the 1978 World Cup, in a match between Sweden and Brazil, referee Clive Thomas signalled for the expiry of time from a Brazilian corner kick while the ball was in mid-flight, with the ball ending up in the net. The tournament's refereeing committee decided that this was a poor use of Thomas's discretionary powers relating to additional time, sending him home from the tournament. It is clear that in this case, Thomas would have been better using his discretion to either end the match before the corner kick was taken, or to find the extra couple of seconds required to see what the outcome of the kick was.
Finally, it is important to note that in some competitions, referees are not permitted to add on any time to allow for time lost. In this case, the referee must end the period as soon as their watch shows that time has exprired for that period (ie 45 minutes, or whatever the competition rules state that the length of the half is).