ensure that DB connections are always closed at thread/process exit