Don't worry about it. As long as you're not messaging him at 5am or 11 at night, you're not doing anything wrong.
Just be sure to thank him for his time and mention that you want to do well (what you said here) after you are done. I don't see how a teacher can be mad after a student genuinely thanks him!