On the existence of minimizers for nonconvex variational problems