close connection, add debug