Non-backtracking random walks and a weighted Ihara's theorem