mysql: fix logging
mysql: allow close connection is other states