fix mysql closing issue