Add sleep to recording writing & remove redundant lock from packet handling