Closed form solution of a periodically forced logistic model