A rare copy of the US Constitution, forgotten among documents in a farmhouse closet, has sold at auction for $9 million.