If the DB failover happened before production, the consequences might not be harsh, but we notice the same behavior as we see in production.
If we don’t close the connection, it will leak connection memory. The connection will remain active until the application server/web server is shut down, even if the user logs out.
There are more justifications. Suppose the database server has 10 connections open and 10 clients request the connection. If the database server grants all of them, and after their usage, they are not closed, the database server would not be able to provide any other connection for another request. For that reason, we need to close them - it is mandatory.
Furthermore, it might lead to some mischievous activities regarding the integrity of the database.
I hope I have answered your query; please let me know if you still have any confusion.