Use allocate rather than PRIM_ALLOC_P in unpackClosure#
This MR addresses ticket #12492 (closed) by replacing the call to ALLOC_PRIM_P with allocate(), as per Simon Marlow's suggestion in the discussion for the ticket.
I am marking this MR as WIP as, while it passes tests, I am not sure whether it would introduce other issues.