Its not a good idea to close statements before using the results. And some white space cleanup.