You must leave through the admission procedure, with the decision issued before you go. Leaving first and applying afterwards generally closes the route.