add callbacks for closing of http connection