Issue #393 Adding missing fire event for onClose with file rendering

Issue #393 - Adding more tests and refactoring duplicated file transmitter code
Why are we doing this instead of using the headers given in the constructor?