wait for proper connection close