Mechanism of bubble detachment from vibrating walls