The dynamics of a magnetic arcade typical of an active region in the solar atmosphere is studied when it is affected by a solar flare occurring somewhere within the enclosure of the arcade. As it expands in the corona propelled by the increased flare pressure, the energetic flare-accelerated particles that are trapped by the field are carried along and can only escape if an appropriate instability is excited. We study a pressure-driven instability of the ballooning-mode type as a releasing mechanism. This is excited as the plasma β within the magnetic enclosure exceeds a critical value shortly after the flare onset and grows in times of the order of 1 s. Since this mode is quickly stabilized, the arcade can continue evolving, decreasing its speed after reaching a maximum by the effect of magnetic tension, and within 1 minute the expansion halts. The remaining trapped particles and plasma may in some cases escape by another mechanism that "opens" the bottle. The possible excitation of a Rayleigh-Taylor instability triggered by an increased density above the arcade is also analyzed, since it has been proposed as a process for releasing energetic particles. Under the prevailing conditions it is not found to be relevant, because the stabilizing effect of the magnetic field suppresses the modes that modify the field lines, while interchange modes would need growth times longer than the arcade expansion time. In some cases there can be a second release of particles later in the expansion, as a result of a magnetic reconnection of the arcade lines with open lines of opposite polarity that are overtaken in the upper corona. Time scales for this process to develop in the low-collisionality plasma are given. This process is found to be extremely fast due to the strong compression of the neutral sheet by the expanding field. The effect of a shock wave moving in front of the expanding bottle on the number of particles injected into interplanetary space is also discussed.