XBee WiFi S6B Pin Sleep not sleeping when connecting to a remote port

I had a similar problem using XBee S6B firmware: 2021 connected to a microcontroller through SPI and with communication through API frames.

Whenever my microcontroller sends an API frame, it starts its own timer. If the timer expires before a response is received, it tries to resend the message, but it will only follow this process up to 5 more times before giving up. If all attempts were unsuccessful, then an ATFR packet is sent (this forces a software reset) and pin sleep is asserted. The xbee enters sleep immediately after being reset.