is a 2nd officer allowed to finish last month of his contract if his gmdss license expired during the voyage?

Yes, but only uptill the completion of the voyage.

Yes. a 2nd officer can sail with his/her GMDSS license expired. As per the STCW rules, only two officers need to have valid GMDSS license.

So if the Master, chief officer and 3rd officer on board has valid GMDSS license, the 2nd officer can continue to sail with GMDSS license expire.