Optimize post agg calculation

This PR improves performance by only calculating the postAggregations once, rather then calculating N times during merge process when N results are being merged into single result.
  
* Calculate postAggregations only after all the results are merged while finalizing results. 
* For topN in case sorting is done on a post aggregated value only that is calculated before finalization