Linear stability of a stratified shear flow slowly varying in time