Close sessions created in the functional API

This is related to #1882 and #1685. By calling close on the session, we
clear the PoolManager operated by the Session and close all sockets.

Fixes #1882
Partially-fixes #1685
Merge pull request #2326 from sigmavirus24/close-functional-sessions

Close sessions created in the functional API