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

Issue #393 - Adding more tests and refactoring duplicated file transmitter code
Would be better to use https://github.com/spockframework/spock/blob/groovy-1.8/spock-core/src/main/java/spock/util/concurrent/BlockingVariable.java here.