Fix "flock(): <ID> is not a valid stream resource"

Update \File::close_file() and fixing an error thrown coming from closing a file-resource before unlocking it