Move tempfile require to lib