Close connections

Try to clean up connections in tests better

@jzoldak @singingwolfboy please review