Everybody saying they never did an essay without listing sources or thinking it's weird that sources were not allowed is not reading the OP. This wasn't a paper, it was a midterm exam. If not for COVID it would have been done in class with no way to legitimately access outside sources. Unless he posts something that contradicts this I'm going to go ahead and assume that's what the professor means.
Yeah, you can use sources, obviously, there's no way for him to prevent it. But you told him you did. Sorry, refer to him to the dean if your A is so precious to you.