Pope Francis became so ill at one stage in hospital that doctors considered ending his treatment and letting him die in peace, his medical team says.