Philadelphia gunman in custody after hourslong standoff