#2653: added synchronization in NearestNeighbourModel and made some related changes to GradientBoostedTreesModelSurrogate