Free sql request after printing it not before