Saudi Arabia has detained 18 people and dismissed five senior government officials as part of an investigation into the death of journalist Jamal Khashoggi.