Fixed issue with tempfile deletion.