Close connections after opening them