BUG: possible fsync error when filno is negative (GH5999)

closes #5999