Fix rpm_hdr_size file closing
The current code will try to close a passed in file object, and will not
try to close a file object it opened when a string is passed in.
This results in either a leaked file object, or a file object that was
passed in to be closed after the function is called.
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>