I did some more testing and I know exactly what the problem is now:
I seems it doesn’t matter if the post is created before the functions.php code or is created after the functions.php code. The problem is that if I click on add a featured image in the settings and upload a foto from my computer, than I can’t remove it. I mean, I can remove it, but it is still on the website while it’s not more in the blogpost settings.
If I use a photo that is already on my website, than I can remove it and it doens’t show anymore on my website.
Is there a fix for that?