close connections for test, return on err for pub