For example, in the detailExpand event handler, get all the master rows without the one that invoked the event(e.masterRow). Then, use the collapseRow for every master row. The code could look like:
detailExpand: function(e) {
var grid = e.sender;
var rows = grid.element.find(".k-master-row").not(e.masterRow);