I believe this is a problem with Minecraft 1.5.2. I've only caught one butterfly and I haven't risked letting it go just in case it despawns (does it?). However if you have other mobs, chickens, pigs etc in a confined area they will glitch into solid blocks and suffocate. In Minecraft 1.6 a fix has been applied to prevent this.
An alternative is to use non-solid blocks, like fencing, but the limitations here is they will glitch out and escape.
If anyone knows of a way to make enclosures safe and escape proof for butterflies and other mobs I'd really like to hear it.