Sorry to hear - must be difficult for you
Without knowing the company's specific policies it's obviously difficult to be clear, but I suspect they are within their rights to do this (even if it's not morally a good thing and does seem very harsh given the circumstances as you've explained...