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

Issue #393 - Adding more tests and refactoring duplicated file transmitter code
nice.