use chrome as the user agent, add a close method, and clean up some code