locked close

Added lock to prevent closing while building (and vice versa).
First draft of log4j 2 implementation