Hello. Experienced this on my saloon W212 when I first had it. Straighten out the plastic tie fitted to the cap so it's not twisted. I found that by dangling the fuel cap until it was straight, replacing the fuel cap, then pushing the plastic tie up so it doesn't obstruct the closing of the closing of the fuel flap, made the flap close each time. It's just a knack I found for myself.
Hope this helps and perhaps you've resolved since the post.