Add on exit file closing in Logger

Add error writing in log on Server and Client
Add message writing in log on Server