Influence of the nuclear medium on the lifetime of the proton