Nothing worse than Gnats. And, it wouldn't typically be the substrate it comes in.. when made, all these are heat treated or methods are used to kill all larva. UV, or something. Its actually how/who you bought it from that stored it poorly.
I had biobizz products. And for a yr no 1 fly with their products. And then I changed growshops and bang, was hit with flies.
Now I treat all my soil. You can ask maker. But most are safe to either put in the oven 220c for 30m wit continue mixing with spoon or whatever (be prepared for a nasty smell, especially if any shit is in it) the one I use. I pour boiling water in a big pot & cover with foil. And kills all any waiting larva.
Looks like you got a real nice harvest. Some very colorful yummy lookin bud