US teen fashion retailer Wet Seal has filed for bankruptcy just days after closing hundreds of its stores and cutting thousands of jobs.

The retailer filed for bankruptcy last Thursday, a week after pulling the shutters down at 338 of its shops and laying off almost 3,700 workers.

However, it has been thrown a lifeline by investment bank B. Riley Financial, which will provide a $20m (£13.18m) loan to help fund its turnaround. If Wet Seal succeeds, B. Riley Financial’s investment will be converted into equity after the retailer emerges from Chapter 11.

The funding would allow Wet Seal to continue to operate 173 of its stores and meet obligations such as timely payment of its remaining employees. Wet Seal will also continue to operate its ecommerce business.

The decision to file for bankruptcy follows a warning from the retailer in December which claimed a filing might be imminent. Wet Seal has come under increasing pressure because of heightened competition from stores such as H&M and Forever 21.

In the bankruptcy filing Wet Seal’s chief financial officer Thomas Hillebrandt said: “The continuing fundamental shift in consumer behaviour away from traditional mall shopping toward online-only stores and increased competition throughout the specialty retail fashion industry have created a difficult operating environment.”

Wet Seal posted a loss of $36m (£23.7m) last quarter after sales slumped 9%.

Wet Seal chief executive Ed Thomas said: “After careful consideration, the board of directors unanimously concluded that filing for Chapter 11 was the appropriate course of action for the company.

“We are thrilled to be working with B. Riley and other constituencies toward the successful and prompt emergence of the company from Chapter 11.”