Analytical treatment of the near field term of the Green function of planarly stratified media