As my knowledge, the visa automatically expires once the work permit does, technically. But they sometimes doesn’t find out. But if you don’t wanna face later visa complications, you better cancel you visa at the immigration with your work permit cancellation letter provided from your work. And better to go out before Aug 1st.
In my case, I didn’t cancel my work permit and my visa was still opening when I left out the country and I didn’t pay any overstaying fees but later I was coming in again with different visa, that opening date was an issue