How do I save a file with managed_file in a theme?
The way it was done in Drupal 7 was that you wrote a function for hook_form_submit where you would 

// Get the File ID (fid).
$fid = $form_status['values']['managed_file_field'];

// Load the file.
$file = file_load($fid);

// Set the status to permanent.
$file-&gt;status = FILE_STATUS_PERMANENT;

// Finally save the file.
$file-&gt;save();


You can read more about this with a great Drupal 7 example here.
I'm sure there's something similar on Drupal 8. You'll just need to register a submit handler for the form. Take a look at the docs for managed_file if you want to go that route. here for it.