Fix in backup output files

(thanks to Toni Giorgino)

I fixed a missing include.

Original comment:
Fixes in backup output files - cant rename open file under windows - print reason for failure - remove leak of FILE*s

(cherry picked from commit 448e84fcfdd0a8f6996a8e6f3307444fc45f6497)