code: public static void safeClose(Channel channel, Closeable... fileChannels) throws IOException {
      if (channel != null && channel.isOpen()) {
        //关闭旧的下载连接
        channel.close();
      }
      if (fileChannels != null && fileChannels.length > 0) {
        for (Closeable closeable : fileChannels) {
          if (closeable != null) {
            //关闭旧的下载文件连接
            closeable.close();
          }
        }
      }
    }
docs: 关闭tcp连接和文件描述符