Modified dispose check
Collect garbage before shutdown
Added TestUnit for TemporaryFile