Building society pledges to keep branches open