Take care of db closed connections

...though, that may just be really annoying looking at the changes...