Fixed the seg fault crash. It was trying to destroy null semaphores.