Reset magic_inited

I lost part of my commit just now.
I don't know if the magic() function can be called multiple times.
In case it can, magic_inited needs to be reset.
The proper way to do this should be to have magic_finalize function to close the fd, but I don't know where it would need to be called from. Any ideas?