Amazon.com is nearing a deal to buy the Hollywood studio MGM Holdings for almost $9 billion, said people familiar with the matter, a pact that would turn a film operation founded in the silent era into a streaming asset for the e-commerce giant.