I wouldn't get discouraged since most people don't even make it to that stage, and being exhausted is certainly understandable after 40 interviews. But have you analyzed or asked for feedback on what it is that was missing from the interview step that the employer was looking for?