Regularity of the optimal sets for the second Dirichlet eigenvalue