close connections when exits