close the ocnnection so redirect works on iphone