close location...

moved the close inside the if statement