Of course! You can leave the dorm whenever you want. But you have to pay the rent until the end of your contract. Please remember to resign from the contract at the due date.