When a company (or a person) is bankrupt it means they have bigger debts than assets, and so no way to repay the debt. Creditors (the companies or people who are owed the money) can apply to have the company declared insolvent, and the court appoints a management group to immediatly take over the company.
The management group (sometimes called receivers or bankruptcy trustees) job is to maximise the amount of money that can be repaid to creditors. This is by selling the assets of the bankrupt company, or rarely to keep it running and repay the debts through operating profits.
In this case, the trustees probably decided that to keep Lehman brothers running independantly would cause further loss of value of Lehman, and that the offer by Barclays bank represented the best return they could get for the creditors of Lehman.
While it seemed harsh, the only other likely option would be that Lehman close and creditors lose all their money. This way they get some of their money back, but probably only a small percentage of the original amount that was owed to them.