Added cors to writeAndClose, and JSON contentType.
Removed appending of corsHeaders in handlers

Now that they are in WriteAndClose.
Dragged attributes one level out.
Changed from completers to future-returns.