close connections on fail