Nodejs and mongodb related problem

This code showing me some problem while I am trying to insert data to the mongodb atlas database.
Err message is like = UnhandledPromiseRejectionWarning: MongoError: topology was destroyed

app.post('/addProduct', (req, res) => {
    const product = req.body;
    client = new MongoClient(uri, { useNewUrlParser: true });
    client.connect(err => {
        const collection = client.db("onlineStore").collection("products");

        console.log(collection.insertOne(product))
        collection.insertOne(product, (err, result) => {
            if (err) {
                console.log(err)
                res.status(500).send({ message: err });
            }
            else {
                res.send(result.ops[0]);
            }
        });
        client.close();
    });
});

This is looks strange and probably should be:

client.connect((err, db) => {
        const collection = db('onlineStore').collection('products');
// ...