Close connection after checking