Wifi stops working after few seconds

It’s probably not fixable. Buy a Wifi USB adapter or replace the internal chip with a different one.
As a temporary workaround you can use your mobile phone in USB tethering mode.