Mosfet knocking out serial connection to computer

Hello all.
I have been trying to use an fdn335n Mosfet to switch a PAM8403 amp module connected to a 3W speaker(with arduino digital pin)
When using the attached configuration, my Serial terminal window stops receiving data. the arduino is still sending it as i checked with my oscilloscope but i can no longer view it in the terminal window. i thought that perhaps there was some back EMF issue or something so i added a diode between the arduino pin and the mofet gate resistor and this seems to have solved the problem.
the thing is i dont actually know whats goin on under the hood and would like to so if anyone could shed some light on the issue id be very appreciative. Thanks!

ps. i did not have this issue when switching a high powered LED or a servo, ie. i didnt need the diode