Close proxies before any other services are closed.

This was causing near cache listener not being remove successfully upon client shutdown. fixes #3669