code: void closeWriter() throws IOException {
      checkState(isRunning(), "Cannot read items from a %s StreamService", state());
      checkState(socketWriter != null, "Attempted to close the socket before it was opened.");
      try {
        socketWriter.close();
      } catch (IOException e) {
        notifyFailed(e);
        throw e;
      }
      closeStream();
    }
docs: Closes the socket writer.