Used the png device directly and closing the sqldf connection

Used the png device directly and closing the sqldf connection