fixing database coonnection close