Well it does sound as though the bottles weren't as clean as you thought. If the problem isn't the bottles, then I can't immediately see why the beer in all of them hasn't turned out the same, since it was the same when it went in there.
My only other thought is re-using caps. If you did this, they may not have been sterile, or possibly leaked.
I'd bet on the bottles. Dark-glass bottles are good for beer shelf-life, because they exclude light, but it can be tricky to see if they are spotlessly clean. This can matter a lot. Say you don't wash all your bottles thoroughly within a short time of pouring. This can result in fungi & bacteria growing in the bottle, feeding on the residual beer. Once they've got going - and it needn't take long - you can get solid encrustations on the glass, and spore formation. At this stage, cleaning is difficult - especially since it's tricky to see inside the bottle. If its not clean, then sterilisation is even more difficult. The spores are not easy to kill and can infect the next brew.
Try bleaching your bottles. Supermarket "thin" bleach is what I use. Here's what I do: don't dilute the bleach, but pour about 300ml into a jug. Line up your bottles (which should be fairly dry inside), and pour all the bleach into the first one. Give it a swirl, then pour the bleach into the second bottle - a smallish funnel helps. Don't be too quick & thorough - leave a discernible amount of the bleach behind, where any beer residue will have been. Keep doing this until all the bottles have been treated. Leave them for several hours, and they should be sterile enough to protect your beer from spoilage. Obviously, rinse well before bottling.
For me, the most important thing, though, is to thoroughly rinse the bottles asap after pouring (use a cleaner/steriliser if you want), so that there is no build-up of spoilage organisms. Remember that several repeated rinses, using a small volume of water each time, is far more effective than one or two rinses using lots of water.
Hope this helps - it's a method that has served me well :)