added close command to sql and corrected misssed mysqli