Specialization in the presence of trade and financial openness