Program handles disconnect gracefully