ok..
i had the same problem and also with 5 sec time before it disconnects
i fixed it by uploading an empty code(i assumed that it will decrease upload time)
-first i connected to pc, waited for arduino to disconnect
-then pressed reset button on arduino board and simultaneously pushed code upload button in software
-when the sketch was still uploading and arduino disconnected i immediately pushed reset button again and it somehow worked for me(after 2-3 time)
now my board is working again
!just for those who encounter the same problem!
try to play around with /reset button/empty code/uploading code in the right time