Close DB connections properly on system exception/exit.