Yes. Firstly, tax withheld on capital gains can be recovered, and you can get a refund. Secondly, if there was also dividend income, you may be eligible for a reduced tax rate if your country of residence has a tax treaty with the U.S.
We can file a non-resident U.S. tax return (Form 1040-NR) for you to allow you to claim this refund. The cost of filing a standard 1040-NR form is $500 (including one W-2). If you also need an additional W-2, 1099, etc., the price will be $550.