Pope greets crowd from hospital window before being discharged