In each epoch, there is a small period when all actions (deposit and withdraw) are prohibited for security. This period is a small part of the epoch and the wallet should notify you that the operations are limited at the moment. This period is 360 blocks with an epoch length of 4332 blocks (approximately 30 minutes and 6 hours, respectively).
Also, is the pool from which you withdraw your stake is currently an active validator, then you must first create a withdrawal order and withdraw (claim order) after the end of the epoch. The wallet automatically selects the necessary option - withdraw or create an order.