commands: close connection after each request

if you don't close the connection after each request the queries
will see the old results into the DB and will not get new values
E.g.: if you add a host the queries will not see the host in the
DB tables