Kaon-antikaon nuclear optical potentials and the κ meson in the nuclear medium