The maximum execution time is not affected by system calls, stream operations etc.
Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.
see PHP manual: Runtime configuration From that I conclude that the fwrite call will properly be executed to the end. The server (e.g. apache) can also force a script to stop. In this case fwrite might get interupted. But as it is 300 as a default you propably do not run into that timeout.