then it will end the program, and I would not have closed the connection to
database that is open.
When the program terminates the connection will be terminated as well.
And the only way you can terminate a database connection in C# anyways is if all of the following are true.
1. You have configured the connection pool to keep no idle connections.
2. There are no connections in use
3. You reset the pool.
Other than that just "closing" the connection does nothing more than return it to the connection pool.