Change exemple of grab_imaqe using with to properly close the connection