SigTerm during file I/O causes gmx_error
The error handler is setup in signal_handler_install using the "signal" function. If a system call is running (e.g. I/O) while the function is running the system call fails with EINTR. One can check everywhere for EINTR and rerun the system call. But much easier is to set the signal behavior to SA_RESTART.
This flag is only available with the function "sigaction" and not with "signal". "signal" doesn't specify whether a syscall is interrupted or not (it is for e.g. Linux). Thus I suggest that in signal_handler_install function "signal" is replaced by sigaction and SA_RESTART is set.
For systems without sigaction (e.g. Windows), we could continue to use "signal".
Restart IO operations when interrupter by signal