`f` here is user defined code and could easily raise an exception. What should we do in that case? Almost seems like we should catch all `Exception` and close the comm if it fails.  But we probably don't want that to be entirely silent.  Hmm...