The HR troubles with Twitter's layoffs—and how to avoid them