> Or am I missing some reason why it doesn't matter that tmp is created here and not deleted?

It is deleted later on.  The second thing returned in each case is whatever thing needs to be cleaned up.  Then the calling routines check whether the thing (if it isn't None) is a string (in which case it is removed, as you described here) or not (in which case it is closed).  

In #364, I encapsulated this step into a function `closeHDUList`, which does this (along with closing the `hdulist` object).  But here it is still done manually.