Poll close fix

Some js fixes including a fix for closing an xhr connection.