BUG: fix writing of logical arrays (gh-4022)

Fixes output type for logical arrays for MATLAB.

MATLAB apparently insists that logical arrays are in output type UINT8.