BUG: opposite side orders won't execute to close a position

I’m getting an error, ‘insufficient qty available for order (requested: 5, available: 1)’ while trying to place an order for an opposite position (in order to close X quantity of trades)

In the example from my logs below, I have 9 short positions in TRS. My algo wants to adjust it to 4 so it tries to place a limit buy order for 5 shares.

2023-06-07 12:14:49 [INFO]: TRS: balance_open_position_sizes: Adjusting position size from 9 to 4
2023-06-07 12:14:49 [INFO]: TRS: balance_open_position_sizes: placing trade buy 5 shares at 29.02 with offset 0 to 4
2023-06-07 12:14:49 [INFO]: place_trade: Placing Limit order buy for 5 shares of TRS @ 29.06
2023-06-07 12:14:49 [WARNING]: place_trade: Error while placing the order for TRS: insufficient qty available for order (requested: 5, available: 1)