YARN-1703. Fixed ResourceManager web-proxy to close connections correctly. Contributed by Rohith Sharma.

(cherry picked from commit 198fb58776ec02397af5ad83259535b0291b745c)
Merge remote-tracking branch 'remotes/origin/branch-2' into branch-2