The former Navy reservist who slaughtered 12 people at the Washington Navy Yard had been “hearing voices” and was being treated for mental problems in the weeks before the shooting rampage, but was not stripped of his security clearance, officials said.