Yes, you wil be able to claim the exclusion of $500K from the gain on sale of the house provided you have not remarried on the date of sale or exchange. See link to the IRS regs on this issue-
Let me know if you have any question.
Please note: This advice is provided with the understanding that all the relevant facts have been provided by you. Any change in facts might affect the advice given and hence may not be relied on in such cases. Nothing contained in this reply was intended or written to be used, can be used by any taxpayer, or may be relied upon or used by any taxpayer for the purposes of avoiding penalties that may be imposed on the taxpayer under the Internal Revenue Code of 1986, as amended.
Yes, you need to sell it this year since you will qualify to file a joint return for this year, even if your spouse is not longer there.