Fix temp file never being deleted when creating InputStream object