Thank you for your question. Such thoughts are not punishable especially when they are not in your control. At the same time, if you want to make tawba do it in a manner which does not increase the thoughts or remind you of them.
The thoughts are stopped by not paying the slightest attention to them and remaining patient. Do not feel bad or saddened by them but just continue as if the thought had not crossed your mind. It requires you to build your mental strength.
May Allah grant you success