Add test: test_session_and_connection_close

This is a test for issue GH-48.