Gray-molasses cooling of 39K to a high phase-space density