Made socketClosed volatile