First of all, there's nothing wrong with the way you asked the question. The same confusion could easily arise among native speakers. "Let me know when you're leaving" can mean both "tell me what time you plan to leave" and "at the time when you leave, let me know." Because the message can be understood either way, your friend may have felt that it was safer to assume that you wanted to know right away.
You could make your meaning more clear by saying "Let me know when you leave school." The phrase "when you are leaving" can be interpreted in two ways ("the time when you will leave" or "at the time when you actually leave"), but "when you leave" is less ambiguous, and would generally be understood to mean "do this at the actual time when you leave."
You could also make it clear by reversing the sentence structure: "When you leave school, let me know." There's no chance of any confusion that way.