Aborted (core dumped) in tf.io.TFRecordWriter
Hi **@vwrewsge** ,

I tried to run your code on colab using tf-nightly and faced same issue. Please find the [gist](https://colab.sandbox.google.com/gist/Venkat6871/6f03e466fa02ef42e060e3e810159132/63337_tf-nightly-v.ipynb) here for reference. We need to work on it, In few days i will provide a solution for it. 

Thank you! Hi **@vwrewsge** ,
- I tried alternative approaches for compression_method and window_bits. I hope it will use for you. Here i am providing [gist](https://colab.sandbox.google.com/gist/Venkat6871/1706a164371da98154b50b3db6232184/63337_nightly-v.ipynb) for your reference.

Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. > Hi **@vwrewsge** ,
> 
> * I tried alternative approaches for compression_method and window_bits. I hope it will use for you. Here i am providing [gist](https://colab.sandbox.google.com/gist/Venkat6871/1706a164371da98154b50b3db6232184/63337_nightly-v.ipynb) for your reference.
> 
> Thank you!

Thank you for your reply. Would it be better to add a validation check to handle these edge cases? Something like [Fix checkfail](https://github.com/tensorflow/tensorflow/pull/63784)
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

binary

### TensorFlow version

tf 2.15

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I have tested on tensorflow-nightly.
There are five bugs related to `tf.io.TFRecordWriter`. 

BUG 1: `compression_method=3` -> Aborted (core dumped)
Code:
```
import tensorflow as tf
input_data = b'input_data_example'
options = tf.io.TFRecordOptions(compression_type='ZLIB', compression_method=3)
with tf.io.TFRecordWriter('output.tfrecord', options=options) as writer:
    writer.write(input_data)
```

BUG 2: `window_bits=-8` -> Aborted (core dumped)
CODE:
```
import tensorflow as tf
input_data = b'input_data_example'

options = tf.io.TFRecordOptions(
    compression_type='ZLIB',
    window_bits=-8  # negative window_bits
)

with tf.io.TFRecordWriter('output.tfrecord', options=options) as writer:
    writer.write(input_data)
```

BUG3: `compression_level=-9` -> Aborted (core dumped)
CODE:
```
import tensorflow as tf
input_data = b'input_data_example'
options = tf.io.TFRecordOptions(compression_type='ZLIB', compression_level=-9)
with tf.io.TFRecordWriter('output.tfrecord', options=options) as writer:
    writer.write(input_data)
```

BUG 4: `mem_level=-10` -> Aborted (core dumped)
CODE:
```
import tensorflow as tf
input_data = b'input_data_example'
options = tf.io.TFRecordOptions(compression_type='ZLIB', mem_level=-10)
with tf.io.TFRecordWriter('output.tfrecord', options=options) as writer:
    writer.write(input_data)
```

BUG 5: `compression_strategy=-2` -> Aborted (core dumped)
```
import tensorflow as tf

input_data = b'input_data_example'
options = tf.io.TFRecordOptions(compression_type='ZLIB', compression_strategy=-2)
with tf.io.TFRecordWriter('output.tfrecord', options=options) as writer:
    writer.write(input_data)
```

### Standalone code to reproduce the issue

```shell
The reproducible test cases are provided above.
```


### Relevant log output

```shell
All the above codes output `Aborted (core dumped)`.
```
