The number of teachers working in Scotland's schools has risen in the last year, but this has been balanced out by a rise in the number of pupils.