<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close(self):
 """ Close the connection to the IOS-XR device. Clean up after you are done and explicitly close the router connection. """

        if self.lock_on_connect or self.locked:
            self.unlock()  # this refers to the config DB
        self._unlock_xml_agent()  # this refers to the XML agent
        if hasattr(self.device, 'remote_conn'):
            self.device.remote_conn.close()