Fix crash database: close the connection once i done using it