def logout(session, cookies, csrf_token):
    '''
    Closes the session with the device.
    '''
    payload = {"jsonrpc": "2.0",
               "id": "ID0",
               "method": "logout",
               "params": []
               }
    session.post(DETAILS['url'],
                 data=json.dumps(payload),
                 cookies=cookies,
                 headers={'X-CSRF-Token': csrf_token})