close connection when request finished