The Xiaomi Redmi Note 9 is a mid-range smartphone by Xiaomi released April 2020. It has a 6.53" IPS LCD display, a 48 MP main camera, a rear-mounted fingerprint sensor, a 5020 mAh battery, and runs on a MediaTek Helio G85.
It is probably a software problem. It may not let you leave because of lag or idk. The only thing I can recommend is that you should update your phone whenever possible to try to keep it up to date and not so buggy. Have you tried to report the problem to Xiaomi?