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

(cherry picked from commit 198fb58776ec02397af5ad83259535b0291b745c)