Fix rare windows crash

Signed-off-by: Rafał Malinowski <rafal.malinowski@corp.bluecherry.net>