1) The field lines appear to be closed loops but you can't conclude that lines are closed or open loops by looking at the picture of field lines because we do not know about alignment of lines that are passing through the bar magnet.
2) The direction of a magnetic line at any point gives the direction of the magnetic force on a north pole placed at that point.
3) Since the direction of magnetic field line is the direction of force on a north pole. So the magnetic lines always begin from the 'N' pole of the magnet and end on the 'S' pole of the magnet.
4) Inside the magnet however the direction of magnetic lines is from S-pole of the magnet to the N-pole of the magnet.
5) Thus the magnetic field lines are closed.