Optimal quadratic solution for the non-Gaussian finite-horizon regulator problem