Added graceful connection close