Precise measurements of the eta meson and the neutral kaon masses with the KLOE detector