Handle temp file leaking problem