closing connection on check()