close cleanly connection