think of it this way:
A pending order means an order that has not yet been processed. As it hasn’t been processed, the market doesn’t yet know you want to buy/sell and therefore cannot find you a match. The market can only start finding a match once the order is processed and recorded on the books.
so if you place an order while the market is closed, your order will execute at the next market open, at whatever rate the market is currently at when the market opens.
that is just how the system works. this is in part why there are a good number of people who want access to the pre-market and after-market. the liquidity and prices may be a bit more volatile and erratic compared to during normal market hours, however they open up the possibility for orders to be executed outside of normal market hours. ideally, you would still only use limit orders to protect yourself from large swings that leave you at a loss.