fix read/write when socket closed
lots of fixes to files being moved/changed/edited and also redirect to canonical directory url