The convertTrafficRecordingToBSON function in the shell calls trafficRecordingFileToBSONArr. When called on a non-existant file, this leaves inputFd <0, which causes crashes when ::close is invoked.
The fix is to move the guard which cleans up the file until after the check that it is valid