A multiclass model of limit order book dynamics and its application to optimal trade execution