code: def loseConnection(self):
          
          if self._stopped:
              result = self._stopped
          elif self.connected:
              result = defer.Deferred()
              self._stopped = result
              self.transport.write(b'\n'.join((b'-stay_open', b'False', b'')))
          else:
              # Already disconnected.
              result = defer.succeed(self)
  
          return result
docs: Close the connection and terminate the exiftool process.
  
          @rtype: C{Deferred}
          @return: A deferred whose callback will be invoked when the connection
          was closed.