[aotinductor] Make writing of the weight files to be conditional (#111379)
Summary: Since we cache the AOTInductor generated library file, we should not need to write the weights as binary file if the library file already exists.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/111379
Approved by: https://github.com/chenyang78