Fixes #3159, Backup failing

Moved file close back to catch block.
Courtesy Marco-Jacob!