Cleaning up tempdb handler.
Merge pull request #247 from nstielau/tempodb_fxes

Cleaning up tempdb handler