I’m a mix of introvert and extrovert, so I will go for a non-committal brief small talk and go into my own devices. I have a few chatty neighbors. At times I would participate in small talk and then go on my day. I don’t like being necessarily rude but at times I feel that I would show a sign of not wanting to talk. Some people don’t take abrupt ending to a conversation very well for understandable reasons.
However if you’re commuting to and from work or traveling across the country there are times you don’t want to talk. I’ve been commuting with public transportation for over a decade now and it’s quite stressful at times. So in this situation I would make non-committal brief small talk and distract myself with a book to read afterwards.